]> git.pld-linux.org Git - packages/Mesa.git/blob - Mesa-git.patch
- rel 6
[packages/Mesa.git] / Mesa-git.patch
1 diff --git a/Makefile b/Makefile
2 index b8069f9..b13ed33 100644
3 --- a/Makefile
4 +++ b/Makefile
5 @@ -347,23 +347,19 @@ GALLIUM_FILES = \
6  
7  DRI_FILES = \
8         $(DIRECTORY)/include/GL/internal/dri_interface.h                \
9 -       $(DIRECTORY)/include/GL/internal/glcore.h                       \
10         $(DIRECTORY)/include/GL/internal/sarea.h                        \
11         $(DIRECTORY)/src/glx/Makefile                                   \
12 -       $(DIRECTORY)/src/glx/Makefile                                   \
13         $(DIRECTORY)/src/glx/*.[ch]                                     \
14         $(DIRECTORY)/src/mesa/drivers/dri/Makefile                      \
15         $(DIRECTORY)/src/mesa/drivers/dri/Makefile.template             \
16         $(DIRECTORY)/src/mesa/drivers/dri/dri.pc.in                     \
17 -       $(DIRECTORY)/src/mesa/drivers/dri/common/xmlpool/*.[ch]         \
18         $(DIRECTORY)/src/mesa/drivers/dri/common/xmlpool/*.po           \
19         $(DIRECTORY)/src/mesa/drivers/dri/*/*.[chS]                     \
20         $(DIRECTORY)/src/mesa/drivers/dri/*/*.cpp                       \
21         $(DIRECTORY)/src/mesa/drivers/dri/*/*/*.[chS]                   \
22         $(DIRECTORY)/src/mesa/drivers/dri/*/Makefile                    \
23         $(DIRECTORY)/src/mesa/drivers/dri/*/*/Makefile                  \
24 -       $(DIRECTORY)/src/mesa/drivers/dri/*/Doxyfile                    \
25 -       $(DIRECTORY)/src/mesa/drivers/dri/*/server/*.[ch]
26 +       $(DIRECTORY)/src/mesa/drivers/dri/*/Doxyfile
27  
28  SGI_GLU_FILES = \
29         $(DIRECTORY)/src/glu/Makefile                                   \
30 diff --git a/docs/devinfo.html b/docs/devinfo.html
31 index df0e726..2d1c125 100644
32 --- a/docs/devinfo.html
33 +++ b/docs/devinfo.html
34 @@ -145,7 +145,7 @@ Make sure the values in src/mesa/main/version.h are correct.
35  </p>
36  
37  <p>
38 -Update the docs/news.html file and docs/download.html files.
39 +Update docs/news.html.
40  </p>
41  
42  <p>
43 @@ -208,10 +208,11 @@ sftp USERNAME,mesa3d@web.sourceforge.net
44  
45  <p>
46  Make an announcement on the mailing lists:
47 -<em>m</em><em>e</em><em>s</em><em>a</em><em>3</em><em>d</em><em>-</em><em>d</em><em>e</em><em>v</em><em>@</em><em>l</em><em>i</em><em>s</em><em>t</em><em>s</em><em>.</em><em>s</em><em>f</em><em>.</em><em>n</em><em>e</em><em>t</em>,
48 -<em>m</em><em>e</em><em>s</em><em>a</em><em>3</em><em>d</em><em>-</em><em>u</em><em>s</em><em>e</em><em>r</em><em>s</em><em>@</em><em>l</em><em>i</em><em>s</em><em>t</em><em>s</em><em>.</em><em>s</em><em>f</em><em>.</em><em>n</em><em>e</em><em>t</em>
49 +
50 +<em>m</em><em>e</em><em>s</em><em>a</em><em>-</em><em>d</em><em>e</em><em>v</em><em>@</em><em>l</em><em>i</em><em>s</em><em>t</em><em>s</em><em>.</em><em>f</em><em>r</em><em>e</em><em>e</em><em>d</em><em>e</em><em>s</em><em>k</em><em>t</em><em>o</em><em>p</em><em>.</em><em>o</em><em>r</em><em>g</em>,
51 +<em>m</em><em>e</em><em>s</em><em>a</em><em>-</em><em>u</em><em>s</em><em>e</em><em>r</em><em>s</em><em>@</em><em>l</em><em>i</em><em>s</em><em>t</em><em>s</em><em>.</em><em>f</em><em>r</em><em>e</em><em>e</em><em>d</em><em>e</em><em>s</em><em>k</em><em>t</em><em>o</em><em>p</em><em>.</em><em>o</em><em>r</em><em>g</em>
52  and
53 -<em>m</em><em>e</em><em>s</em><em>a</em><em>3</em><em>d</em><em>-</em><em>a</em><em>n</em><em>n</em><em>o</em><em>u</em><em>n</em><em>c</em><em>e</em><em>@</em><em>l</em><em>i</em><em>s</em><em>t</em><em>s</em><em>.</em><em>s</em><em>f</em><em>.</em><em>n</em><em>e</em><em>t</em>
54 +<em>m</em><em>e</em><em>s</em><em>a</em><em>-</em><em>a</em><em>n</em><em>n</em><em>o</em><em>u</em><em>n</em><em>c</em><em>e</em><em>@</em><em>l</em><em>i</em><em>s</em><em>t</em><em>s</em><em>.</em><em>f</em><em>r</em><em>e</em><em>e</em><em>d</em><em>e</em><em>s</em><em>k</em><em>t</em><em>o</em><em>p</em><em>.</em><em>o</em><em>r</em><em>g</em>
55  </p>
56  
57  
58 diff --git a/docs/news.html b/docs/news.html
59 index b3fb8b5..72d38ee 100644
60 --- a/docs/news.html
61 +++ b/docs/news.html
62 @@ -11,10 +11,18 @@
63  <H1>News</H1>
64  
65  
66 +<h2>October 4, 2010</h2>
67 +
68 +<p>
69 +<a href="relnotes-7.9.html">Mesa 7.9</a> (final) is released.  This is a new
70 +development release.
71 +</p>
72 +
73 +
74  <h2>September 27, 2010</h2>
75  
76  <p>
77 -<a href="relnotes-7.9.0.html">Mesa 7.9.0-rc1</a> is released.  This is a
78 +<a href="relnotes-7.9.html">Mesa 7.9.0-rc1</a> is released.  This is a
79  release candidate for the 7.9 development release.
80  </p>
81  
82 diff --git a/docs/relnotes-7.8.2.html b/docs/relnotes-7.8.2.html
83 index e1b0f2d..1393b2e 100644
84 --- a/docs/relnotes-7.8.2.html
85 +++ b/docs/relnotes-7.8.2.html
86 @@ -26,7 +26,15 @@ for DRI hardware acceleration.
87  
88  <h2>MD5 checksums</h2>
89  <pre>
90 -tbd
91 +c89b63d253605ed40e8ac370d25a833c  MesaLib-7.8.2.tar.gz
92 +6be2d343a0089bfd395ce02aaf8adb57  MesaLib-7.8.2.tar.bz2
93 +a04ad3b06ac5ff3969a003fa7bbf7d5b  MesaLib-7.8.2.zip
94 +7c213f92efeb471f0331670d5079d4c0  MesaDemos-7.8.2.tar.gz
95 +757d9e2e06f48b1a52848be9b0307ced  MesaDemos-7.8.2.tar.bz2
96 +8d0e5cfe68b8ebf90265d350ae2c48b1  MesaDemos-7.8.2.zip
97 +b74482e3f44f35ed395c4aada4fd8240  MesaGLUT-7.8.2.tar.gz
98 +a471807b65e49c325808ba4551be93ed  MesaGLUT-7.8.2.tar.bz2
99 +9f190268c42be582ef66e47365ee61e3  MesaGLUT-7.8.2.zip
100  </pre>
101  
102  
103 @@ -44,10 +52,95 @@ tbd
104  <ul>
105  <li>Fixed Gallium glDrawPixels(GL_DEPTH_COMPONENT).
106  <li>Fixed Gallium Cell driver to buildable, runable state
107 +<li>Fixed bad error checking for glFramebufferRenderbuffer(attachment=GL_DEPTH_STENCIL_ATTACHMENT).
108 +<li>Fixed incorrect Z coordinate handling in "meta" glDraw/CopyPixels.
109 +    <a href="https://bugs.freedesktop.org/show_bug.cgi?id=23670">Bug
110 +    #23670</a>.</li>
111 +
112 +<li>Assorted i965 driver fixes.
113 +    Including but not limited to:
114 +  <ul>
115 +    <li>Fix scissoring when width or height is
116 +    0.  <a href="https://bugs.freedesktop.org/show_bug.cgi?id=27643">Bug
117 +    #27643</a>.
118 +    <li>Fix bit allocation for number of color regions for
119 +    ARB_draw_buffers.</li>
120 +    <li>Set the correct provoking vertex for clipped first-mode
121 +    trifans.  <a href="https://bugs.freedesktop.org/show_bug.cgi?id=24470">Bug
122 +    #24470</a>.</li>
123 +    <li>Use <code>R16G16B16A16_FLOAT</code> for 3-component half-float.</li>
124 +    <li>Fix assertion for surface tile offset usage on Ironlake.</li>
125 +    <li>Fix cube map layouts on Ironlake.</li>
126 +    <li>When an RB gets a new region, clear the old from the state
127 +    cache.  <a href="https://bugs.freedesktop.org/show_bug.cgi?id=24119">Bug
128 +    #24119</a>.</li>
129 +    <li>Reject shaders with uninlined function calls instead of hanging.</li>
130 +  </ul>
131 +</li>
132 +
133 +<li>Assorted i915 driver fixes.  Including but not limited to:
134 +  <ul>
135 +    <li>Fixed texture LOD clamping in i915 driver.
136 +    <a href="https://bugs.freedesktop.org/show_bug.cgi?id=24846">Bug
137 +    #24846</a>.</li>
138 +    <li>Fix off-by-one for drawing rectangle.
139 +    <a href="https://bugs.freedesktop.org/show_bug.cgi?id=27408">Bug
140 +    #27408</a>.</li>
141 +  </ul>
142 +</li>
143 +
144 +<li>Fixed hangs in etracer on 830 and 845
145 +    chipsets.  <a href="https://bugs.freedesktop.org/show_bug.cgi?id=26557">Bug
146 +    #26557</a>.</li>
147 +<li>Fixed tiling of small textures on all Intel drivers.</li>
148 +<li>Fixed crash in Savage driver when using <code>_mesa_CopyTexImage2D</code>.
149 +    <a href="https://bugs.freedesktop.org/show_bug.cgi?id=27652">Bug
150 +    #27652</a>.</li>
151 +
152 +<li>Assorted GLX fixes.  Including but not limited to:
153 +  <ul>
154 +    <li>Fixed <code>__glXInitializeVisualConfigFromTags</code>'s handling of
155 +        unrecognized fbconfig tags.</li>
156 +    <li>Fixed regression with <code>GLX_USE_GL</code>.
157 +    <li>Fixed config chooser logic for 'mask' matching.</li>
158 +    <li>Report swap events correctly in direct rendered case (DRI2)</li>
159 +    <li>Fixed build with dri2proto which doesn't define
160 +        <code>X_DRI2SwapInterval</code>.</li>
161 +    <li>Get <code>GLX_SCREEN</code> first in <code>__glXQueryContextInfo</code>.
162 +        <a href="https://bugs.freedesktop.org/show_bug.cgi?id=14245">Bug
163 +       #14245</a>.</li>
164 +  </ul>
165 +</li>
166 +
167 +<li>Assorted GLSL fixes.  Including but not limited to:
168 +  <ul>
169 +    <li>Change variable declared assertion into conditional in GLSL
170 +        compiler.  <a href="https://bugs.freedesktop.org/show_bug.cgi?id=27921">Bug
171 +        #27921</a>.</li>
172 +    <li>Fix instruction indexing
173 +        bugs.  <a href="https://bugs.freedesktop.org/show_bug.cgi?id=27566">Bug
174 +        #27566</a>.</li>
175 +    <li>Updated uniform location / offset encoding to be more like
176 +        other implementations.</li>
177 +    <li>Don't overwrite a driver's shader infolog with generic failure
178 +        message.</li>
179 +  </ul>
180 +</li>
181 +
182 +<li>Fixed OSMesa build for 16 and 32-bit color channel depth.
183 +<li>Fixed OSMesa build with hidden symbol visibility. libOSMesa no longer links to libGL.
184 +    <a href="https://bugs.freedesktop.org/show_bug.cgi?id=28305">Bug
185 +    #28305</a>.
186 +<li>Fixed handling of multiple render targets in fixed-function
187 +    texture envrionmnent programs.</li>
188 +<li>Fixed conversion errors in <code>signed_rgba8888[rev]</code> texel
189 +    fetch.</li>
190 +<li>Don't set srcLevel on <code>GL_TEXTURE_RECTANGLE_ARB</code> targets.</li>
191 +<li>Various build fixes for OpenBSD.</li>
192 +<li>Various build fixes for OS X.</li>
193 +<li>Various build fixes for GCC 3.3.</li>
194  </ul>
195  
196  
197 -<h2>Changes</h2>
198 -<p>None.</p>
199  </body>
200  </html>
201 diff --git a/docs/relnotes-7.8.3.html b/docs/relnotes-7.8.3.html
202 new file mode 100644
203 index 0000000..1e9f433
204 --- /dev/null
205 +++ b/docs/relnotes-7.8.3.html
206 @@ -0,0 +1,89 @@
207 +<HTML>
208 +
209 +<TITLE>Mesa Release Notes</TITLE>
210 +
211 +<head><link rel="stylesheet" type="text/css" href="mesa.css"></head>
212 +
213 +<BODY>
214 +
215 +<body bgcolor="#eeeeee">
216 +
217 +<H1>Mesa 7.8.3 Release Notes / (date tbd)</H1>
218 +
219 +<p>
220 +Mesa 7.8.3 is a bug fix release which fixes bugs found since the 7.8.2 release.
221 +</p>
222 +<p>
223 +Mesa 7.8.3 implements the OpenGL 2.1 API, but the version reported by
224 +glGetString(GL_VERSION) depends on the particular driver being used.
225 +Some drivers don't support all the features required in OpenGL 2.1.
226 +</p>
227 +<p>
228 +See the <a href="install.html">Compiling/Installing page</a> for prerequisites
229 +for DRI hardware acceleration.
230 +</p>
231 +
232 +
233 +<h2>MD5 checksums</h2>
234 +<pre>
235 +x  MesaLib-7.8.3.tar.gz
236 +x  MesaLib-7.8.3.tar.bz2
237 +x  MesaLib-7.8.3.zip
238 +x  MesaDemos-7.8.3.tar.gz
239 +x  MesaDemos-7.8.3.tar.bz2
240 +x  MesaDemos-7.8.3.zip
241 +x  MesaGLUT-7.8.3.tar.gz
242 +x  MesaGLUT-7.8.3.tar.bz2
243 +x  MesaGLUT-7.8.3.zip
244 +</pre>
245 +
246 +
247 +<h2>New features</h2>
248 +<p>None.</p>
249 +
250 +
251 +<h2>Changes</h2>
252 +<ul>
253 +<li>The radeon driver should use less memory when searching for a valid mip
254 +image.</li>
255 +</ul>
256 +
257 +
258 +<h2>Bug fixes</h2>
259 +<ul>
260 +<li>Fix unsupported FB with D24S8 (bug 
261 +    <a href="https://bugs.freedesktop.org/show_bug.cgi?id=23670">29116</a>)</li>
262 +<li>Fix ReadPixels crash when reading depth/stencil from an FBO</li>
263 +<li>Fixed a bug rendering to 16-bit buffers using swrast.</li>
264 +<li>Fixed a state tracker/TGSI bug that caused crashes when using Windows'
265 +    memory debugging features.</li>
266 +<li>Fixed an issue rendering to 32-bit channels with swrast (bug
267 +    <a href="https://bugs.freedesktop.org/show_bug.cgi?id=29487">29487</a>)</li>
268 +<li>GLSL: fix indirect <TT>gl_TextureMatrix</TT> addressing (bug
269 +    <a href="https://bugs.freedesktop.org/show_bug.cgi?id=28967">28967</a>)</li>
270 +<li>GLSL: fix for bug
271 +    <a href="https://bugs.freedesktop.org/show_bug.cgi?id=27216">27216</a></li>
272 +<li>GLSL: fix zw fragcoord entries in some cases (bug
273 +    <a href="https://bugs.freedesktop.org/show_bug.cgi?id=29183">29183</a>)</li>
274 +<li>Fix texture env generation in some cases (bug
275 +    <a href="https://bugs.freedesktop.org/show_bug.cgi?id=28169">28169</a>)</li>
276 +<li>osmesa: a fix for calling <TT>OSMesaMakeCurrent</TT> twice was applied (bug 
277 +    <a href="https://bugs.freedesktop.org/show_bug.cgi?id=10966">10966</a></li>
278 +<li>A bug was fixed which could cause Mesa to ignore the
279 +    <TT>MESA_EXTENSION_OVERRIDE</TT> environment variable.</li>
280 +<li>A bug related to specular highlights on backfaces was fixed.</li>
281 +<li>A radeon-specific issue with <TT>glCopyTex(Sub)Image</TT> was
282 +    corrected.</li>
283 +<li>radeon/wine: flush command stream in more cases, fixing wine d3d9
284 +    tests.</li>
285 +<li>r600: fix sin+cos normalization.</li>
286 +<li>r600: (properly) ignore <TT>GL_COORD_REPLACE</TT> when point sprites are
287 +    disabled.</li>
288 +<li>radeon: avoid flushing when the context is not current.</li>
289 +<li>r300c: a bug affecting unaligned BOs was fixed.</li>
290 +<li>r300c: a hardlock caused by ARB_half_float_vertex incorrectly advertised on some chipsets.</li>
291 +</ul>
292 +
293 +
294 +</body>
295 +</html>
296 diff --git a/docs/relnotes-7.9.html b/docs/relnotes-7.9.html
297 index b09fb1d..fe1fd5e 100644
298 --- a/docs/relnotes-7.9.html
299 +++ b/docs/relnotes-7.9.html
300 @@ -28,12 +28,12 @@ for DRI hardware acceleration.
301  
302  <h2>MD5 checksums</h2>
303  <pre>
304 -f1f01a7baec255f13e9468fb4b05922a  MesaLib-7.9-rc1.tar.gz
305 -7ffbda3b7056c60b8f87e3082d853af1  MesaLib-7.9-rc1.tar.bz2
306 -9d4650df4e5b530178d6fde840f76664  MesaLib-7.9-rc1.zip
307 -a81c2e7a0c7832e67c768d6f209f2c8f  MesaGLUT-7.9-rc1.tar.gz
308 -b4c1c2f0b47a07be10fa2dd42e6a63d7  MesaGLUT-7.9-rc1.tar.bz2
309 -c9dd7419a19bcb24a1fe556ec2e78451  MesaGLUT-7.9-rc1.zip
310 +ed65ab425b25895c7f473d0a5e6e64f8  MesaLib-7.9.tar.gz
311 +82c740c49d572baa6da2b1a1eee90bca  MesaLib-7.9.tar.bz2
312 +cd2b6ecec759b0457475e94bbb38fedb  MesaLib-7.9.zip
313 +7b54af9fb9b1f6a1a65db2520f50848f  MesaGLUT-7.9.tar.gz
314 +20d07419d1929f833fdb36bced290ad5  MesaGLUT-7.9.tar.bz2
315 +62a7edecd7c92675cd6029b05217eb0a  MesaGLUT-7.9.zip
316  </pre>
317  
318  
319 diff --git a/docs/relnotes.html b/docs/relnotes.html
320 index 47e7f80..4487af9 100644
321 --- a/docs/relnotes.html
322 +++ b/docs/relnotes.html
323 @@ -14,6 +14,7 @@ The release notes summarize what's new or changed in each Mesa release.
324  
325  <UL>
326  <LI><A HREF="relnotes-7.9.html">7.9 release notes</A>
327 +<LI><A HREF="relnotes-7.8.3.html">7.8.3 release notes</A>
328  <LI><A HREF="relnotes-7.8.2.html">7.8.2 release notes</A>
329  <LI><A HREF="relnotes-7.8.1.html">7.8.1 release notes</A>
330  <LI><A HREF="relnotes-7.8.html">7.8 release notes</A>
331 diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
332 index 9c4ff56..4a6506c 100644
333 --- a/src/egl/drivers/dri2/egl_dri2.c
334 +++ b/src/egl/drivers/dri2/egl_dri2.c
335 @@ -741,7 +741,7 @@ dri2_create_screen(_EGLDisplay *disp)
336     if (dri2_dpy->dri2->base.version >= 2)
337        api_mask = dri2_dpy->dri2->getAPIMask(dri2_dpy->dri_screen);
338     else
339 -      api_mask = __DRI_API_OPENGL;
340 +      api_mask = 1 << __DRI_API_OPENGL;
341  
342     disp->ClientAPIsMask = 0;
343     if (api_mask & (1 <<__DRI_API_OPENGL))
344 diff --git a/src/egl/main/eglcontext.c b/src/egl/main/eglcontext.c
345 index bc22913..763b1b3 100644
346 --- a/src/egl/main/eglcontext.c
347 +++ b/src/egl/main/eglcontext.c
348 @@ -272,10 +272,6 @@ _eglCheckMakeCurrent(_EGLContext *ctx, _EGLSurface *draw, _EGLSurface *read)
349     if (!surfaceless && (draw == NULL || read == NULL))
350        return _eglError(EGL_BAD_MATCH, "eglMakeCurrent");
351  
352 -   /* context stealing from another thread is not allowed */
353 -   if (ctx->Binding && ctx->Binding != t)
354 -      return _eglError(EGL_BAD_ACCESS, "eglMakeCurrent");
355 -
356     /*
357      * The spec says
358      *
359 @@ -283,16 +279,23 @@ _eglCheckMakeCurrent(_EGLContext *ctx, _EGLSurface *draw, _EGLSurface *read)
360      * bound to contexts in another thread, an EGL_BAD_ACCESS error is
361      * generated."
362      *
363 -    * But it also says
364 +    * and
365      *
366      * "at most one context may be bound to a particular surface at a given
367      * time"
368 -    *
369 -    * The latter is more restrictive so we can check only the latter case.
370      */
371 -   if ((draw && draw->CurrentContext && draw->CurrentContext != ctx) ||
372 -       (read && read->CurrentContext && read->CurrentContext != ctx))
373 +   if (ctx->Binding && ctx->Binding != t)
374        return _eglError(EGL_BAD_ACCESS, "eglMakeCurrent");
375 +   if (draw && draw->CurrentContext && draw->CurrentContext != ctx) {
376 +      if (draw->CurrentContext->Binding != t ||
377 +          draw->CurrentContext->ClientAPI != ctx->ClientAPI)
378 +         return _eglError(EGL_BAD_ACCESS, "eglMakeCurrent");
379 +   }
380 +   if (read && read->CurrentContext && read->CurrentContext != ctx) {
381 +      if (read->CurrentContext->Binding != t ||
382 +          read->CurrentContext->ClientAPI != ctx->ClientAPI)
383 +         return _eglError(EGL_BAD_ACCESS, "eglMakeCurrent");
384 +   }
385  
386     /* simply require the configs to be equal */
387     if ((draw && draw->Config != ctx->Config) ||
388 diff --git a/src/egl/main/egldriver.h b/src/egl/main/egldriver.h
389 index c618feb..950774f 100644
390 --- a/src/egl/main/egldriver.h
391 +++ b/src/egl/main/egldriver.h
392 @@ -4,7 +4,7 @@
393  
394  #include "egltypedefs.h"
395  #include "eglapi.h"
396 -
397 +#include <stddef.h>
398  
399  /**
400   * Define an inline driver typecast function.
401 diff --git a/src/gallium/state_trackers/egl/Makefile b/src/gallium/state_trackers/egl/Makefile
402 index 8dbfc5b..8cfcef9 100644
403 --- a/src/gallium/state_trackers/egl/Makefile
404 +++ b/src/gallium/state_trackers/egl/Makefile
405 @@ -17,7 +17,7 @@ x11_INCLUDES = \
406         -I$(TOP)/src/mapi \
407         -I$(TOP)/src/mesa \
408         $(X11_CFLAGS) \
409 -       $(shell pkg-config --cflags-only-I libdrm)
410 +       $(shell pkg-config --cflags-only-I libdrm dri2proto)
411  
412  x11_SOURCES = $(wildcard x11/*.c) \
413               $(TOP)/src/glx/dri2.c
414 diff --git a/src/gallium/state_trackers/egl/common/egl_g3d_api.c b/src/gallium/state_trackers/egl/common/egl_g3d_api.c
415 index c0164da..3bde397 100644
416 --- a/src/gallium/state_trackers/egl/common/egl_g3d_api.c
417 +++ b/src/gallium/state_trackers/egl/common/egl_g3d_api.c
418 @@ -609,8 +609,10 @@ egl_g3d_wait_client(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *ctx)
419  
420     gctx->stctxi->flush(gctx->stctxi,
421           PIPE_FLUSH_RENDER_CACHE | PIPE_FLUSH_FRAME, &fence);
422 -   screen->fence_finish(screen, fence, 0);
423 -   screen->fence_reference(screen, &fence, NULL);
424 +   if (fence) {
425 +      screen->fence_finish(screen, fence, 0);
426 +      screen->fence_reference(screen, &fence, NULL);
427 +   }
428  
429     return EGL_TRUE;
430  }
431 diff --git a/src/gallium/state_trackers/egl/x11/native_x11.h b/src/gallium/state_trackers/egl/x11/native_x11.h
432 index 0b47837..8945117 100644
433 --- a/src/gallium/state_trackers/egl/x11/native_x11.h
434 +++ b/src/gallium/state_trackers/egl/x11/native_x11.h
435 @@ -27,6 +27,7 @@
436  #define _NATIVE_X11_H_
437  
438  #include "common/native.h"
439 +#include <X11/Xlib.h>
440  
441  struct native_display *
442  x11_create_ximage_display(Display *dpy,
443 diff --git a/src/gallium/state_trackers/vega/api_context.c b/src/gallium/state_trackers/vega/api_context.c
444 index 0d04d8e..d6bbda5 100644
445 --- a/src/gallium/state_trackers/vega/api_context.c
446 +++ b/src/gallium/state_trackers/vega/api_context.c
447 @@ -73,7 +73,8 @@ void vegaFinish(void)
448     pipe = ctx->pipe;
449  
450     pipe->flush(pipe, PIPE_FLUSH_RENDER_CACHE | PIPE_FLUSH_FRAME, &fence);
451 -
452 -   pipe->screen->fence_finish(pipe->screen, fence, 0);
453 -   pipe->screen->fence_reference(pipe->screen, &fence, NULL);
454 +   if (fence) {
455 +      pipe->screen->fence_finish(pipe->screen, fence, 0);
456 +      pipe->screen->fence_reference(pipe->screen, &fence, NULL);
457 +   }
458  }
459 diff --git a/src/gallium/state_trackers/vega/vg_manager.c b/src/gallium/state_trackers/vega/vg_manager.c
460 index e799674..232deef 100644
461 --- a/src/gallium/state_trackers/vega/vg_manager.c
462 +++ b/src/gallium/state_trackers/vega/vg_manager.c
463 @@ -352,7 +352,7 @@ vg_api_create_context(struct st_api *stapi, struct st_manager *smapi,
464        return NULL;
465  
466     /* only 1.0 is supported */
467 -   if (attribs->major != 1 || attribs->minor > 0)
468 +   if (attribs->major > 1 || (attribs->major == 1 && attribs->minor > 0))
469        return NULL;
470  
471     pipe = smapi->screen->context_create(smapi->screen, NULL);
472 diff --git a/src/gallium/state_trackers/xorg/Makefile b/src/gallium/state_trackers/xorg/Makefile
473 index cb2c3ae..7a44d28 100644
474 --- a/src/gallium/state_trackers/xorg/Makefile
475 +++ b/src/gallium/state_trackers/xorg/Makefile
476 @@ -10,7 +10,7 @@ LIBRARY_INCLUDES = \
477         $(shell pkg-config libkms --atleast-version=1.0 \
478                                 && echo "-DHAVE_LIBKMS") \
479         $(shell pkg-config libkms --silence-errors --cflags-only-I) \
480 -       $(shell pkg-config --cflags-only-I pixman-1 xorg-server libdrm xproto) \
481 +       $(shell pkg-config --cflags-only-I pixman-1 xorg-server libdrm xproto dri2proto) \
482         -I$(TOP)/src/gallium/include \
483         -I$(TOP)/src/gallium/auxiliary \
484         -I$(TOP)/include \
485 diff --git a/src/gallium/state_trackers/xorg/xorg_crtc.c b/src/gallium/state_trackers/xorg/xorg_crtc.c
486 index 26a907f..80af82d 100644
487 --- a/src/gallium/state_trackers/xorg/xorg_crtc.c
488 +++ b/src/gallium/state_trackers/xorg/xorg_crtc.c
489 @@ -234,6 +234,10 @@ crtc_load_cursor_argb_ga3d(xf86CrtcPtr crtc, CARD32 * image)
490                    64, 64, (void*)image, 64 * 4, 0, 0);
491      ms->ctx->transfer_unmap(ms->ctx, transfer);
492      ms->ctx->transfer_destroy(ms->ctx, transfer);
493 +
494 +    if (crtc->cursor_shown)
495 +       drmModeSetCursor(ms->fd, crtcp->drm_crtc->crtc_id,
496 +                        crtcp->cursor_handle, 64, 64);
497  }
498  
499  #if HAVE_LIBKMS
500 @@ -271,6 +275,10 @@ crtc_load_cursor_argb_kms(xf86CrtcPtr crtc, CARD32 * image)
501      memcpy(ptr, image, 64*64*4);
502      kms_bo_unmap(crtcp->cursor_bo);
503  
504 +    if (crtc->cursor_shown)
505 +       drmModeSetCursor(ms->fd, crtcp->drm_crtc->crtc_id,
506 +                        crtcp->cursor_handle, 64, 64);
507 +
508      return;
509  
510  err_bo_destroy:
511 @@ -353,7 +361,7 @@ crtc_destroy(xf86CrtcPtr crtc)
512  
513      drmModeFreeCrtc(crtcp->drm_crtc);
514  
515 -    xfree(crtcp);
516 +    free(crtcp);
517      crtc->driver_private = NULL;
518  }
519  
520 @@ -401,7 +409,7 @@ xorg_crtc_init(ScrnInfoPtr pScrn)
521         if (crtc == NULL)
522             goto out;
523  
524 -       crtcp = xcalloc(1, sizeof(struct crtc_private));
525 +       crtcp = calloc(1, sizeof(struct crtc_private));
526         if (!crtcp) {
527             xf86CrtcDestroy(crtc);
528             goto out;
529 diff --git a/src/gallium/state_trackers/xorg/xorg_dri2.c b/src/gallium/state_trackers/xorg/xorg_dri2.c
530 index 704aed6..b723a8e 100644
531 --- a/src/gallium/state_trackers/xorg/xorg_dri2.c
532 +++ b/src/gallium/state_trackers/xorg/xorg_dri2.c
533 @@ -201,11 +201,11 @@ dri2_create_buffer(DrawablePtr pDraw, unsigned int attachment, unsigned int form
534      DRI2Buffer2Ptr buffer;
535      BufferPrivatePtr private;
536  
537 -    buffer = xcalloc(1, sizeof *buffer);
538 +    buffer = calloc(1, sizeof *buffer);
539      if (!buffer)
540         return NULL;
541  
542 -    private = xcalloc(1, sizeof *private);
543 +    private = calloc(1, sizeof *private);
544      if (!private) {
545         goto fail;
546      }
547 @@ -217,9 +217,9 @@ dri2_create_buffer(DrawablePtr pDraw, unsigned int attachment, unsigned int form
548      if (dri2_do_create_buffer(pDraw, (DRI2BufferPtr)buffer, format))
549         return buffer;
550  
551 -    xfree(private);
552 +    free(private);
553  fail:
554 -    xfree(buffer);
555 +    free(buffer);
556      return NULL;
557  }
558  
559 @@ -229,8 +229,8 @@ dri2_destroy_buffer(DrawablePtr pDraw, DRI2Buffer2Ptr buffer)
560      /* So far it is safe to downcast a DRI2Buffer2Ptr to DRI2BufferPtr */
561      dri2_do_destroy_buffer(pDraw, (DRI2BufferPtr)buffer);
562  
563 -    xfree(buffer->driverPrivate);
564 -    xfree(buffer);
565 +    free(buffer->driverPrivate);
566 +    free(buffer);
567  }
568  
569  #endif /* DRI2INFOREC_VERSION >= 2 */
570 @@ -244,11 +244,11 @@ dri2_create_buffers(DrawablePtr pDraw, unsigned int *attachments, int count)
571      DRI2BufferPtr buffers;
572      int i;
573  
574 -    buffers = xcalloc(count, sizeof *buffers);
575 +    buffers = calloc(count, sizeof *buffers);
576      if (!buffers)
577         goto fail_buffers;
578  
579 -    privates = xcalloc(count, sizeof *privates);
580 +    privates = calloc(count, sizeof *privates);
581      if (!privates)
582         goto fail_privates;
583  
584 @@ -263,9 +263,9 @@ dri2_create_buffers(DrawablePtr pDraw, unsigned int *attachments, int count)
585      return buffers;
586  
587  fail:
588 -    xfree(privates);
589 +    free(privates);
590  fail_privates:
591 -    xfree(buffers);
592 +    free(buffers);
593  fail_buffers:
594      return NULL;
595  }
596 @@ -280,8 +280,8 @@ dri2_destroy_buffers(DrawablePtr pDraw, DRI2BufferPtr buffers, int count)
597      }
598  
599      if (buffers) {
600 -       xfree(buffers[0].driverPrivate);
601 -       xfree(buffers);
602 +       free(buffers[0].driverPrivate);
603 +       free(buffers);
604      }
605  }
606  
607 diff --git a/src/gallium/state_trackers/xorg/xorg_driver.c b/src/gallium/state_trackers/xorg/xorg_driver.c
608 index e10ff2f..1ec772d 100644
609 --- a/src/gallium/state_trackers/xorg/xorg_driver.c
610 +++ b/src/gallium/state_trackers/xorg/xorg_driver.c
611 @@ -45,6 +45,7 @@
612  #include "miscstruct.h"
613  #include "dixstruct.h"
614  #include "xf86xv.h"
615 +#include "xorgVersion.h"
616  #ifndef XSERVER_LIBPCIACCESS
617  #error "libpciaccess needed"
618  #endif
619 @@ -122,7 +123,7 @@ xorg_tracker_set_functions(ScrnInfoPtr scrn)
620  Bool
621  xorg_tracker_have_modesetting(ScrnInfoPtr pScrn, struct pci_device *device)
622  {
623 -    char *BusID = xalloc(64);
624 +    char *BusID = malloc(64);
625      sprintf(BusID, "pci:%04x:%02x:%02x.%d",
626             device->domain, device->bus,
627             device->dev, device->func);
628 @@ -130,14 +131,14 @@ xorg_tracker_have_modesetting(ScrnInfoPtr pScrn, struct pci_device *device)
629      if (drmCheckModesettingSupported(BusID)) {
630         xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 0,
631                        "Drm modesetting not supported %s\n", BusID);
632 -       xfree(BusID);
633 +       free(BusID);
634         return FALSE;
635      }
636  
637      xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 0,
638                    "Drm modesetting supported on %s\n", BusID);
639  
640 -    xfree(BusID);
641 +    free(BusID);
642      return TRUE;
643  }
644  
645 @@ -174,7 +175,7 @@ drv_free_rec(ScrnInfoPtr pScrn)
646      if (!pScrn->driverPrivate)
647         return;
648  
649 -    xfree(pScrn->driverPrivate);
650 +    free(pScrn->driverPrivate);
651  
652      pScrn->driverPrivate = NULL;
653  }
654 @@ -274,7 +275,7 @@ drv_init_drm(ScrnInfoPtr pScrn)
655      if (ms->fd < 0) {
656         char *BusID;
657  
658 -       BusID = xalloc(64);
659 +       BusID = malloc(64);
660         sprintf(BusID, "PCI:%d:%d:%d",
661                 ((ms->PciInfo->domain << 8) | ms->PciInfo->bus),
662                 ms->PciInfo->dev, ms->PciInfo->func
663 @@ -283,7 +284,7 @@ drv_init_drm(ScrnInfoPtr pScrn)
664  
665         ms->fd = drmOpen(driver_descriptor.driver_name, BusID);
666         ms->isMaster = TRUE;
667 -       xfree(BusID);
668 +       free(BusID);
669  
670         if (ms->fd >= 0)
671             return TRUE;
672 @@ -369,6 +370,7 @@ drv_pre_init(ScrnInfoPtr pScrn, int flags)
673      ms = modesettingPTR(pScrn);
674      ms->pEnt = pEnt;
675      ms->cust = cust;
676 +    ms->fb_id = -1;
677  
678      pScrn->displayWidth = 640;        /* default it */
679  
680 @@ -402,19 +404,6 @@ drv_pre_init(ScrnInfoPtr pScrn, int flags)
681      if (!drv_init_drm(pScrn))
682         return FALSE;
683  
684 -    use3D = cust ? !cust->no_3d : TRUE;
685 -    ms->from_3D = xf86GetOptValBool(ms->Options, OPTION_3D_ACCEL,
686 -                                   &use3D) ?
687 -       X_CONFIG : X_PROBED;
688 -
689 -    ms->no3D = !use3D;
690 -
691 -    if (!drv_init_resource_management(pScrn)) {
692 -       xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Could not init "
693 -                                              "Gallium3D or libKMS.");
694 -       return FALSE;
695 -    }
696 -
697      pScrn->monitor = pScrn->confScreen->monitor;
698      pScrn->progClock = TRUE;
699      pScrn->rgbBits = 8;
700 @@ -444,11 +433,24 @@ drv_pre_init(ScrnInfoPtr pScrn, int flags)
701  
702      /* Process the options */
703      xf86CollectOptions(pScrn, NULL);
704 -    if (!(ms->Options = xalloc(sizeof(drv_options))))
705 +    if (!(ms->Options = malloc(sizeof(drv_options))))
706         return FALSE;
707      memcpy(ms->Options, drv_options, sizeof(drv_options));
708      xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, ms->Options);
709  
710 +    use3D = cust ? !cust->no_3d : TRUE;
711 +    ms->from_3D = xf86GetOptValBool(ms->Options, OPTION_3D_ACCEL,
712 +                                   &use3D) ?
713 +       X_CONFIG : X_PROBED;
714 +
715 +    ms->no3D = !use3D;
716 +
717 +    if (!drv_init_resource_management(pScrn)) {
718 +       xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Could not init "
719 +                                              "Gallium3D or libKMS.");
720 +       return FALSE;
721 +    }
722 +
723      /* Allocate an xf86CrtcConfig */
724      xf86CrtcConfigInit(pScrn, &crtc_config_funcs);
725      xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
726 @@ -791,7 +793,9 @@ drv_screen_init(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
727      if (!ms->SWCursor)
728         xf86_cursors_init(pScreen, 64, 64,
729                           HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_64 |
730 -                         HARDWARE_CURSOR_ARGB);
731 +                         HARDWARE_CURSOR_ARGB |
732 +                         ((cust && cust->unhidden_hw_cursor_update) ?
733 +                          HARDWARE_CURSOR_UPDATE_UNHIDDEN : 0));
734  
735      /* Must force it before EnterVT, so we are in control of VT and
736       * later memory should be bound when allocating, e.g rotate_mem */
737 @@ -862,8 +866,10 @@ drv_leave_vt(int scrnIndex, int flags)
738         }
739      }
740  
741 -    drmModeRmFB(ms->fd, ms->fb_id);
742 -    ms->fb_id = -1;
743 +    if (ms->fb_id != -1) {
744 +       drmModeRmFB(ms->fd, ms->fb_id);
745 +       ms->fb_id = -1;
746 +    }
747  
748      /* idle hardware */
749      if (!ms->kms)
750 @@ -944,7 +950,6 @@ drv_close_screen(int scrnIndex, ScreenPtr pScreen)
751      }
752  #endif
753  
754 -    drmModeRmFB(ms->fd, ms->fb_id);
755      ms->destroy_front_buffer(pScrn);
756  
757      if (ms->exa)
758 @@ -1178,6 +1183,8 @@ drv_bind_front_buffer_kms(ScrnInfoPtr pScrn)
759                                 stride,
760                                 ptr);
761  
762 +#if (XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(1, 9, 99, 1, 0))
763 +
764      /* This a hack to work around EnableDisableFBAccess setting the pointer
765       * the real fix would be to replace pScrn->EnableDisableFBAccess hook
766       * and set the rootPixmap->devPrivate.ptr to something valid before that.
767 @@ -1187,6 +1194,8 @@ drv_bind_front_buffer_kms(ScrnInfoPtr pScrn)
768       */
769      pScrn->pixmapPrivate.ptr = ptr;
770  
771 +#endif
772 +
773      return TRUE;
774  
775  err_destroy:
776 diff --git a/src/gallium/state_trackers/xorg/xorg_exa.c b/src/gallium/state_trackers/xorg/xorg_exa.c
777 index 6b2c80f..0e5693d 100644
778 --- a/src/gallium/state_trackers/xorg/xorg_exa.c
779 +++ b/src/gallium/state_trackers/xorg/xorg_exa.c
780 @@ -720,7 +720,7 @@ ExaCreatePixmap(ScreenPtr pScreen, int size, int align)
781  {
782      struct exa_pixmap_priv *priv;
783  
784 -    priv = xcalloc(1, sizeof(struct exa_pixmap_priv));
785 +    priv = calloc(1, sizeof(struct exa_pixmap_priv));
786      if (!priv)
787         return NULL;
788  
789 @@ -737,7 +737,7 @@ ExaDestroyPixmap(ScreenPtr pScreen, void *dPriv)
790  
791      pipe_resource_reference(&priv->tex, NULL);
792  
793 -    xfree(priv);
794 +    free(priv);
795  }
796  
797  static Bool
798 @@ -975,7 +975,7 @@ xorg_exa_close(ScrnInfoPtr pScrn)
799     ms->ctx = NULL;
800  
801     exaDriverFini(pScrn->pScreen);
802 -   xfree(exa);
803 +   free(exa);
804     ms->exa = NULL;
805  }
806  
807 @@ -987,7 +987,7 @@ xorg_exa_init(ScrnInfoPtr pScrn, Bool accel)
808     ExaDriverPtr pExa;
809     CustomizerPtr cust = ms->cust;
810  
811 -   exa = xcalloc(1, sizeof(struct exa_context));
812 +   exa = calloc(1, sizeof(struct exa_context));
813     if (!exa)
814        return NULL;
815  
816 diff --git a/src/gallium/state_trackers/xorg/xorg_output.c b/src/gallium/state_trackers/xorg/xorg_output.c
817 index 61206ed..5555b51 100644
818 --- a/src/gallium/state_trackers/xorg/xorg_output.c
819 +++ b/src/gallium/state_trackers/xorg/xorg_output.c
820 @@ -128,7 +128,7 @@ output_get_modes(xf86OutputPtr output)
821      for (i = 0; i < drm_connector->count_modes; i++) {
822         drm_mode = &drm_connector->modes[i];
823         if (drm_mode) {
824 -           mode = xcalloc(1, sizeof(DisplayModeRec));
825 +           mode = calloc(1, sizeof(DisplayModeRec));
826             if (!mode)
827                 continue;
828             mode->Clock = drm_mode->clock;
829 @@ -195,7 +195,7 @@ output_destroy(xf86OutputPtr output)
830  {
831      struct output_private *priv = output->driver_private;
832      drmModeFreeConnector(priv->drm_connector);
833 -    xfree(priv);
834 +    free(priv);
835      output->driver_private = NULL;
836  }
837  
838 @@ -262,14 +262,14 @@ xorg_output_init(ScrnInfoPtr pScrn)
839                  drm_connector->connector_type_id);
840  
841  
842 -       priv = xcalloc(sizeof(*priv), 1);
843 +       priv = calloc(sizeof(*priv), 1);
844         if (!priv) {
845             continue;
846         }
847  
848         output = xf86OutputCreate(pScrn, &output_funcs, name);
849         if (!output) {
850 -           xfree(priv);
851 +           free(priv);
852             continue;
853         }
854  
855 diff --git a/src/gallium/state_trackers/xorg/xorg_tracker.h b/src/gallium/state_trackers/xorg/xorg_tracker.h
856 index be1a9fd..a3fb5e5 100644
857 --- a/src/gallium/state_trackers/xorg/xorg_tracker.h
858 +++ b/src/gallium/state_trackers/xorg/xorg_tracker.h
859 @@ -76,6 +76,7 @@ typedef struct _CustomizerRec
860      Bool dirty_throttling;
861      Bool swap_throttling;
862      Bool no_3d;
863 +    Bool unhidden_hw_cursor_update;
864      Bool (*winsys_pre_init) (struct _CustomizerRec *cust, int fd);
865      Bool (*winsys_screen_init)(struct _CustomizerRec *cust);
866      Bool (*winsys_screen_close)(struct _CustomizerRec *cust);
867 diff --git a/src/gallium/state_trackers/xorg/xorg_xv.c b/src/gallium/state_trackers/xorg/xorg_xv.c
868 index f98bd93..f64959f 100644
869 --- a/src/gallium/state_trackers/xorg/xorg_xv.c
870 +++ b/src/gallium/state_trackers/xorg/xorg_xv.c
871 @@ -536,8 +536,10 @@ display_video(ScrnInfoPtr pScrn, struct xorg_xv_port_priv *pPriv, int id,
872     dst_surf = xorg_gpu_surface(pPriv->r->pipe->screen, dst);
873     hdtv = ((src_w >= RES_720P_X) && (src_h >= RES_720P_Y));
874  
875 +#ifdef COMPOSITE
876     REGION_TRANSLATE(pScrn->pScreen, dstRegion, -pPixmap->screen_x,
877                      -pPixmap->screen_y);
878 +#endif
879  
880     dxo = dstRegion->extents.x1;
881     dyo = dstRegion->extents.y1;
882 @@ -562,11 +564,16 @@ display_video(ScrnInfoPtr pScrn, struct xorg_xv_port_priv *pPriv, int id,
883        int box_y2 = pbox->y2;
884        float diff_x = (float)src_w / (float)dst_w;
885        float diff_y = (float)src_h / (float)dst_h;
886 -      float offset_x = box_x1 - dstX + pPixmap->screen_x;
887 -      float offset_y = box_y1 - dstY + pPixmap->screen_y;
888 +      float offset_x = box_x1 - dstX;
889 +      float offset_y = box_y1 - dstY;
890        float offset_w;
891        float offset_h;
892  
893 +#ifdef COMPOSITE
894 +      offset_x += pPixmap->screen_x;
895 +      offset_y += pPixmap->screen_y;
896 +#endif
897 +
898        x = box_x1;
899        y = box_y1;
900        w = box_x2 - box_x1;
901 diff --git a/src/gallium/targets/Makefile.dri b/src/gallium/targets/Makefile.dri
902 index 59961e9..3fb4cc6 100644
903 --- a/src/gallium/targets/Makefile.dri
904 +++ b/src/gallium/targets/Makefile.dri
905 @@ -80,7 +80,7 @@ $(LIBNAME): $(OBJECTS) $(MESA_MODULES) $(PIPE_DRIVERS) Makefile \
906                 $(OBJECTS) $(PIPE_DRIVERS) \
907                  -Wl,--start-group $(MESA_MODULES) -Wl,--end-group \
908                   $(DRI_LIB_DEPS) $(DRIVER_EXTRAS)
909 -       $(CXX) $(CFLAGS) -o $@.test $(TOP)/src/mesa/drivers/dri/common/dri_test.o $@.tmp $(DRI_LIB_DEPS);
910 +       $(CXX) $(CFLAGS) -o $@.test $(TOP)/src/mesa/drivers/dri/common/dri_test.o $@.tmp $(DRI_LIB_DEPS) $(LDFLAGS);
911         @rm -f $@.test
912         mv -f $@.tmp $@
913  
914 diff --git a/src/gallium/targets/Makefile.xorg b/src/gallium/targets/Makefile.xorg
915 index 762c905..87eedd7 100644
916 --- a/src/gallium/targets/Makefile.xorg
917 +++ b/src/gallium/targets/Makefile.xorg
918 @@ -29,7 +29,7 @@ INCLUDES = \
919  LIBNAME_STAGING = $(TOP)/$(LIB_DIR)/gallium/$(TARGET)
920  
921  ifeq ($(MESA_LLVM),1)
922 -LD = g++
923 +LD = $(CXX)
924  LDFLAGS += $(LLVM_LDFLAGS)
925  USE_CXX=1
926  DRIVER_PIPES += $(TOP)/src/gallium/drivers/llvmpipe/libllvmpipe.a
927 @@ -42,7 +42,7 @@ endif
928  default: depend $(TOP)/$(LIB_DIR)/gallium $(LIBNAME) $(LIBNAME_STAGING)
929  
930  $(LIBNAME): $(OBJECTS) Makefile ../Makefile.xorg $(LIBS) $(DRIVER_PIPES)
931 -       $(MKLIB) -noprefix -o $@ $(LDFLAGS) $(OBJECTS) $(DRIVER_PIPES) $(GALLIUM_AUXILIARIES) $(DRIVER_LINKS)
932 +       $(MKLIB) -linker $(CC) -noprefix -o $@ $(LDFLAGS) $(OBJECTS) $(DRIVER_PIPES) $(GALLIUM_AUXILIARIES) $(DRIVER_LINKS)
933  
934  depend: $(C_SOURCES) $(CPP_SOURCES) $(ASM_SOURCES) $(SYMLINKS) $(GENERATED_SOURCES)
935         rm -f depend
936 diff --git a/src/gallium/targets/dri-vmwgfx/Makefile b/src/gallium/targets/dri-vmwgfx/Makefile
937 index 97c703b..38f7893 100644
938 --- a/src/gallium/targets/dri-vmwgfx/Makefile
939 +++ b/src/gallium/targets/dri-vmwgfx/Makefile
940 @@ -12,6 +12,7 @@ PIPE_DRIVERS = \
941  
942  C_SOURCES = \
943         target.c \
944 +       vmw_powf.c \
945         $(COMMON_GALLIUM_SOURCES)
946  
947  DRIVER_DEFINES = \
948 diff --git a/src/gallium/targets/dri-vmwgfx/vmw_powf.c b/src/gallium/targets/dri-vmwgfx/vmw_powf.c
949 new file mode 100644
950 index 0000000..ca5e39b
951 --- /dev/null
952 +++ b/src/gallium/targets/dri-vmwgfx/vmw_powf.c
953 @@ -0,0 +1,17 @@
954 +/**
955 + * Powf may leave an unresolved symbol pointing to a libstdc++.so powf.
956 + * However, not all libstdc++.so include this function, so optionally
957 + * replace the powf function with calls to expf and logf.
958 + */
959 +
960 +#ifdef VMW_RESOLVE_POWF
961 +
962 +extern float expf(float x);
963 +extern float logf(float x);
964 +extern float powf(float x, float y);
965 +
966 +float powf(float x, float y) {
967 +    return expf(logf(x)*y);
968 +}
969 +
970 +#endif
971 diff --git a/src/gallium/targets/egl/Makefile b/src/gallium/targets/egl/Makefile
972 index 47c24ce..38e60db 100644
973 --- a/src/gallium/targets/egl/Makefile
974 +++ b/src/gallium/targets/egl/Makefile
975 @@ -24,7 +24,9 @@ common_CPPFLAGS := \
976         -I$(TOP)/src/gallium/auxiliary \
977         -I$(TOP)/src/gallium/drivers \
978         -I$(TOP)/src/gallium/include \
979 -       -I$(TOP)/src/gallium/winsys
980 +       -I$(TOP)/src/gallium/winsys \
981 +       $(LIBDRM_CFLAGS)
982 +
983  common_SYS :=
984  common_LIBS := \
985         $(TOP)/src/gallium/drivers/identity/libidentity.a \
986 @@ -41,11 +43,11 @@ egl_SYS := -lm $(DLOPEN_LIBS) -L$(TOP)/$(LIB_DIR) -lEGL
987  egl_LIBS := $(TOP)/src/gallium/state_trackers/egl/libegl.a
988  
989  ifneq ($(findstring x11, $(EGL_PLATFORMS)),)
990 -egl_SYS += -lX11 -lXext -lXfixes
991 +egl_SYS += -lX11 -lXext -lXfixes $(LIBDRM_LIB)
992  egl_LIBS += $(TOP)/src/gallium/winsys/sw/xlib/libws_xlib.a
993  endif
994 -ifneq ($(findstring kms, $(EGL_PLATFORMS)),)
995 -egl_SYS += -ldrm
996 +ifneq ($(findstring drm, $(EGL_PLATFORMS)),)
997 +egl_SYS += $(LIBDRM_LIB)
998  endif
999  ifneq ($(findstring fbdev, $(EGL_PLATFORMS)),)
1000  egl_LIBS += $(TOP)/src/gallium/winsys/sw/fbdev/libfbdev.a
1001 diff --git a/src/gallium/targets/egl/pipe_i965.c b/src/gallium/targets/egl/pipe_i965.c
1002 index 43bf646..36b03b3 100644
1003 --- a/src/gallium/targets/egl/pipe_i965.c
1004 +++ b/src/gallium/targets/egl/pipe_i965.c
1005 @@ -1,6 +1,7 @@
1006  
1007  #include "target-helpers/inline_wrapper_sw_helper.h"
1008  #include "target-helpers/inline_debug_helper.h"
1009 +#include "target-helpers/inline_wrapper_sw_helper.h"
1010  #include "state_tracker/drm_driver.h"
1011  #include "i965/drm/i965_drm_public.h"
1012  #include "i965/brw_public.h"
1013 diff --git a/src/gallium/targets/xorg-vmwgfx/vmw_ctrl.c b/src/gallium/targets/xorg-vmwgfx/vmw_ctrl.c
1014 index 237b308..9b422e6 100644
1015 --- a/src/gallium/targets/xorg-vmwgfx/vmw_ctrl.c
1016 +++ b/src/gallium/targets/xorg-vmwgfx/vmw_ctrl.c
1017 @@ -32,6 +32,7 @@
1018   *      allows X clients to communicate with the driver.
1019   */
1020  
1021 +#include <xorg-server.h>
1022  #include "dixstruct.h"
1023  #include "extnsionst.h"
1024  #include <X11/X.h>
1025 @@ -211,7 +212,7 @@ VMwareCtrlDoSetTopology(ScrnInfoPtr pScrn,
1026     struct vmw_customizer *vmw = vmw_customizer(xorg_customizer(pScrn));
1027     int i;
1028  
1029 -   rects = xcalloc(number, sizeof(*rects));
1030 +   rects = calloc(number, sizeof(*rects));
1031     if (!rects)
1032        return FALSE;
1033  
1034 @@ -224,7 +225,7 @@ VMwareCtrlDoSetTopology(ScrnInfoPtr pScrn,
1035  
1036     vmw_ioctl_update_layout(vmw, number, rects);
1037  
1038 -   xfree(rects);
1039 +   free(rects);
1040     return TRUE;
1041  }
1042  
1043 diff --git a/src/gallium/targets/xorg-vmwgfx/vmw_ioctl.c b/src/gallium/targets/xorg-vmwgfx/vmw_ioctl.c
1044 index 7c799b5..7625d2f 100644
1045 --- a/src/gallium/targets/xorg-vmwgfx/vmw_ioctl.c
1046 +++ b/src/gallium/targets/xorg-vmwgfx/vmw_ioctl.c
1047 @@ -165,7 +165,7 @@ vmw_ioctl_buffer_create(struct vmw_customizer *vmw, uint32_t size, unsigned *han
1048      struct drm_vmw_dmabuf_rep *rep = &arg.rep;
1049      int ret;
1050  
1051 -    buf = xcalloc(1, sizeof(*buf));
1052 +    buf = calloc(1, sizeof(*buf));
1053      if (!buf)
1054         goto err;
1055  
1056 @@ -192,7 +192,7 @@ vmw_ioctl_buffer_create(struct vmw_customizer *vmw, uint32_t size, unsigned *han
1057      return buf;
1058  
1059  err_free:
1060 -    xfree(buf);
1061 +    free(buf);
1062  err:
1063      return NULL;
1064  }
1065 @@ -211,7 +211,7 @@ vmw_ioctl_buffer_destroy(struct vmw_customizer *vmw, struct vmw_dma_buffer *buf)
1066      arg.handle = buf->handle; 
1067      drmCommandWrite(vmw->fd, DRM_VMW_UNREF_DMABUF, &arg, sizeof(arg)); 
1068  
1069 -    xfree(buf); 
1070 +    free(buf);
1071  } 
1072  
1073  void *
1074 diff --git a/src/gallium/targets/xorg-vmwgfx/vmw_screen.c b/src/gallium/targets/xorg-vmwgfx/vmw_screen.c
1075 index 8173908..7662203 100644
1076 --- a/src/gallium/targets/xorg-vmwgfx/vmw_screen.c
1077 +++ b/src/gallium/targets/xorg-vmwgfx/vmw_screen.c
1078 @@ -245,6 +245,7 @@ vmw_screen_pre_init(ScrnInfoPtr pScrn, int flags)
1079      cust->winsys_enter_vt = vmw_screen_enter_vt;
1080      cust->winsys_leave_vt = vmw_screen_leave_vt;
1081      cust->no_3d = TRUE;
1082 +    cust->unhidden_hw_cursor_update = TRUE;
1083      vmw->pScrn = pScrn;
1084  
1085      pScrn->driverPrivate = cust;
1086 diff --git a/src/gallium/targets/xorg-vmwgfx/vmw_video.c b/src/gallium/targets/xorg-vmwgfx/vmw_video.c
1087 index eced60d..94465e5 100644
1088 --- a/src/gallium/targets/xorg-vmwgfx/vmw_video.c
1089 +++ b/src/gallium/targets/xorg-vmwgfx/vmw_video.c
1090 @@ -300,7 +300,7 @@ vmw_video_init(struct vmw_customizer *vmw)
1091          numAdaptors = 1;
1092          overlayAdaptors = &newAdaptor;
1093      } else {
1094 -         newAdaptors = xalloc((numAdaptors + 1) *
1095 +         newAdaptors = malloc((numAdaptors + 1) *
1096                                sizeof(XF86VideoAdaptorPtr*));
1097           if (!newAdaptors) {
1098              xf86XVFreeVideoAdaptorRec(newAdaptor);
1099 @@ -320,7 +320,7 @@ vmw_video_init(struct vmw_customizer *vmw)
1100      }
1101  
1102      if (newAdaptors) {
1103 -        xfree(newAdaptors);
1104 +        free(newAdaptors);
1105      }
1106  
1107      debug_printf("Initialized VMware Xv extension successfully\n");
1108 @@ -438,7 +438,7 @@ vmw_video_init_adaptor(ScrnInfoPtr pScrn, struct vmw_customizer *vmw)
1109          return NULL;
1110      }
1111  
1112 -    video = xcalloc(1, sizeof(*video));
1113 +    video = calloc(1, sizeof(*video));
1114      if (!video) {
1115          debug_printf("Not enough memory.\n");
1116          xf86XVFreeVideoAdaptorRec(adaptor);
1117 @@ -742,7 +742,7 @@ vmw_video_buffer_alloc(struct vmw_customizer *vmw, int size,
1118      }
1119  
1120      out->size = size;
1121 -    out->extra_data = xcalloc(1, size);
1122 +    out->extra_data = calloc(1, size);
1123  
1124      debug_printf("\t\t%s: allocated buffer %p of size %i\n", __func__, out, size);
1125  
1126 @@ -773,7 +773,7 @@ vmw_video_buffer_free(struct vmw_customizer *vmw,
1127      if (out->size == 0)
1128         return Success;
1129  
1130 -    xfree(out->extra_data);
1131 +    free(out->extra_data);
1132      vmw_ioctl_buffer_unmap(vmw, out->buf);
1133      vmw_ioctl_buffer_destroy(vmw, out->buf);
1134  
1135 diff --git a/src/glsl/glsl_parser.cpp b/src/glsl/glsl_parser.cpp
1136 index 301c221..ad99eee 100644
1137 --- a/src/glsl/glsl_parser.cpp
1138 +++ b/src/glsl/glsl_parser.cpp
1139 @@ -1,9 +1,9 @@
1140 -/* A Bison parser, made by GNU Bison 2.4.3.  */
1141 +/* A Bison parser, made by GNU Bison 2.4.2.  */
1142  
1143  /* Skeleton implementation for Bison's Yacc-like parsers in C
1144     
1145 -      Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
1146 -   2009, 2010 Free Software Foundation, Inc.
1147 +      Copyright (C) 1984, 1989-1990, 2000-2006, 2009-2010 Free Software
1148 +   Foundation, Inc.
1149     
1150     This program is free software: you can redistribute it and/or modify
1151     it under the terms of the GNU General Public License as published by
1152 @@ -45,7 +45,7 @@
1153  #define YYBISON 1
1154  
1155  /* Bison version.  */
1156 -#define YYBISON_VERSION "2.4.3"
1157 +#define YYBISON_VERSION "2.4.2"
1158  
1159  /* Skeleton name.  */
1160  #define YYSKELETON_NAME "yacc.c"
1161 @@ -2621,7 +2621,7 @@ YYLTYPE yylloc;
1162      YYLTYPE *yylsp;
1163  
1164      /* The locations where the error started and ended.  */
1165 -    YYLTYPE yyerror_range[3];
1166 +    YYLTYPE yyerror_range[2];
1167  
1168      YYSIZE_T yystacksize;
1169  
1170 @@ -5084,7 +5084,7 @@ yyerrlab:
1171  #endif
1172      }
1173  
1174 -  yyerror_range[1] = yylloc;
1175 +  yyerror_range[0] = yylloc;
1176  
1177    if (yyerrstatus == 3)
1178      {
1179 @@ -5121,7 +5121,7 @@ yyerrorlab:
1180    if (/*CONSTCOND*/ 0)
1181       goto yyerrorlab;
1182  
1183 -  yyerror_range[1] = yylsp[1-yylen];
1184 +  yyerror_range[0] = yylsp[1-yylen];
1185    /* Do not reclaim the symbols of the rule which action triggered
1186       this YYERROR.  */
1187    YYPOPSTACK (yylen);
1188 @@ -5155,7 +5155,7 @@ yyerrlab1:
1189        if (yyssp == yyss)
1190         YYABORT;
1191  
1192 -      yyerror_range[1] = *yylsp;
1193 +      yyerror_range[0] = *yylsp;
1194        yydestruct ("Error: popping",
1195                   yystos[yystate], yyvsp, yylsp, state);
1196        YYPOPSTACK (1);
1197 @@ -5165,10 +5165,10 @@ yyerrlab1:
1198  
1199    *++yyvsp = yylval;
1200  
1201 -  yyerror_range[2] = yylloc;
1202 +  yyerror_range[1] = yylloc;
1203    /* Using YYLLOC is tempting, but would change the location of
1204       the lookahead.  YYLOC is available though.  */
1205 -  YYLLOC_DEFAULT (yyloc, yyerror_range, 2);
1206 +  YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 2);
1207    *++yylsp = yyloc;
1208  
1209    /* Shift the error token.  */
1210 diff --git a/src/glsl/glsl_parser.h b/src/glsl/glsl_parser.h
1211 index 4a78037..266a4a2 100644
1212 --- a/src/glsl/glsl_parser.h
1213 +++ b/src/glsl/glsl_parser.h
1214 @@ -1,9 +1,9 @@
1215 -/* A Bison parser, made by GNU Bison 2.4.3.  */
1216 +/* A Bison parser, made by GNU Bison 2.4.2.  */
1217  
1218  /* Skeleton interface for Bison's Yacc-like parsers in C
1219     
1220 -      Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
1221 -   2009, 2010 Free Software Foundation, Inc.
1222 +      Copyright (C) 1984, 1989-1990, 2000-2006, 2009-2010 Free Software
1223 +   Foundation, Inc.
1224     
1225     This program is free software: you can redistribute it and/or modify
1226     it under the terms of the GNU General Public License as published by
1227 diff --git a/src/mesa/Makefile b/src/mesa/Makefile
1228 index c41c38c..8b0756b 100644
1229 --- a/src/mesa/Makefile
1230 +++ b/src/mesa/Makefile
1231 @@ -34,9 +34,9 @@ ES1_CPPFLAGS := -DFEATURE_ES1=1 $(DEFINES)
1232  ES2_CPPFLAGS := -DFEATURE_ES2=1 $(DEFINES)
1233  
1234  # append include dirs
1235 -MESA_CPPFLAGS += $(INCLUDE_DIRS)
1236 -ES1_CPPFLAGS += -I$(TOP)/src/mapi/es1api $(INCLUDE_DIRS)
1237 -ES2_CPPFLAGS += -I$(TOP)/src/mapi/es2api $(INCLUDE_DIRS)
1238 +MESA_CPPFLAGS += $(INCLUDE_DIRS) $(TALLOC_CFLAGS)
1239 +ES1_CPPFLAGS += -I$(TOP)/src/mapi/es1api $(INCLUDE_DIRS) $(TALLOC_CFLAGS)
1240 +ES2_CPPFLAGS += -I$(TOP)/src/mapi/es2api $(INCLUDE_DIRS) $(TALLOC_CFLAGS)
1241  
1242  # tidy compiler flags
1243  CFLAGS := $(filter-out $(DEFINES), $(CFLAGS))
1244 diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
1245 index a03cb68..20dda5f 100644
1246 --- a/src/mesa/drivers/common/meta.c
1247 +++ b/src/mesa/drivers/common/meta.c
1248 @@ -1385,6 +1385,7 @@ _mesa_meta_Clear(GLcontext *ctx, GLbitfield buffers)
1249     struct vertex verts[4];
1250     /* save all state but scissor, pixel pack/unpack */
1251     GLbitfield metaSave = META_ALL - META_SCISSOR - META_PIXEL_STORE;
1252 +   const GLuint stencilMax = (1 << ctx->DrawBuffer->Visual.stencilBits) - 1;
1253  
1254     if (buffers & BUFFER_BITS_COLOR) {
1255        /* if clearing color buffers, don't save/restore colormask */
1256 @@ -1440,7 +1441,7 @@ _mesa_meta_Clear(GLcontext *ctx, GLbitfield buffers)
1257        _mesa_StencilOpSeparate(GL_FRONT_AND_BACK,
1258                                GL_REPLACE, GL_REPLACE, GL_REPLACE);
1259        _mesa_StencilFuncSeparate(GL_FRONT_AND_BACK, GL_ALWAYS,
1260 -                                ctx->Stencil.Clear & 0x7fffffff,
1261 +                                ctx->Stencil.Clear & stencilMax,
1262                                  ctx->Stencil.WriteMask[0]);
1263     }
1264     else {
1265 diff --git a/src/mesa/drivers/dri/r200/r200_swtcl.c b/src/mesa/drivers/dri/r200/r200_swtcl.c
1266 index dbf4ad4..160e7e7 100644
1267 --- a/src/mesa/drivers/dri/r200/r200_swtcl.c
1268 +++ b/src/mesa/drivers/dri/r200/r200_swtcl.c
1269 @@ -319,10 +319,9 @@ static INLINE GLuint reduced_hw_prim( GLcontext *ctx, GLuint prim)
1270  {
1271     switch (prim) {
1272     case GL_POINTS:
1273 -      return (ctx->Point.PointSprite ||
1274 -        ((ctx->_TriangleCaps & (DD_POINT_SIZE | DD_POINT_ATTEN)) &&
1275 -        !(ctx->_TriangleCaps & (DD_POINT_SMOOTH)))) ?
1276 -        R200_VF_PRIM_POINT_SPRITES : R200_VF_PRIM_POINTS;
1277 +      return (((R200_CONTEXT(ctx))->radeon.radeonScreen->drmSupportsPointSprites &&
1278 +              !(ctx->_TriangleCaps & DD_POINT_SMOOTH)) ?
1279 +        R200_VF_PRIM_POINT_SPRITES : R200_VF_PRIM_POINTS);
1280     case GL_LINES:
1281     /* fallthrough */
1282     case GL_LINE_LOOP:
1283 @@ -613,6 +612,9 @@ static void r200RasterPrimitive( GLcontext *ctx, GLuint hwprim )
1284     r200ContextPtr rmesa = R200_CONTEXT(ctx);
1285  
1286     radeon_prepare_render(&rmesa->radeon);
1287 +   if (rmesa->radeon.NewGLState)
1288 +      r200ValidateState( ctx );
1289 +
1290  
1291     if (rmesa->radeon.swtcl.hw_primitive != hwprim) {
1292        /* need to disable perspective-correct texturing for point sprites */
1293 diff --git a/src/mesa/drivers/dri/r200/r200_tcl.c b/src/mesa/drivers/dri/r200/r200_tcl.c
1294 index 4ae0f30..2743997 100644
1295 --- a/src/mesa/drivers/dri/r200/r200_tcl.c
1296 +++ b/src/mesa/drivers/dri/r200/r200_tcl.c
1297 @@ -68,9 +68,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1298  #define HAVE_ELTS        1
1299  
1300  
1301 -#define HW_POINTS           ((ctx->Point.PointSprite || \
1302 -                               ((ctx->_TriangleCaps & (DD_POINT_SIZE | DD_POINT_ATTEN)) && \
1303 -                               !(ctx->_TriangleCaps & (DD_POINT_SMOOTH)))) ? \
1304 +#define HW_POINTS           (((R200_CONTEXT(ctx))->radeon.radeonScreen->drmSupportsPointSprites && \
1305 +                             !(ctx->_TriangleCaps & DD_POINT_SMOOTH)) ? \
1306                                 R200_VF_PRIM_POINT_SPRITES : R200_VF_PRIM_POINTS)
1307  #define HW_LINES            R200_VF_PRIM_LINES
1308  #define HW_LINE_LOOP        0
1309 @@ -265,6 +264,8 @@ void r200TclPrimitive( GLcontext *ctx,
1310     GLuint newprim = hw_prim | R200_VF_TCL_OUTPUT_VTX_ENABLE;
1311  
1312     radeon_prepare_render(&rmesa->radeon);
1313 +   if (rmesa->radeon.NewGLState)
1314 +      r200ValidateState( ctx );
1315  
1316     if (newprim != rmesa->tcl.hw_primitive ||
1317         !discrete_prim[hw_prim&0xf]) {
1318 diff --git a/src/mesa/drivers/dri/r300/compiler/r300_fragprog_emit.c b/src/mesa/drivers/dri/r300/compiler/r300_fragprog_emit.c
1319 index 3b2b06f..9f19f8f 100644
1320 --- a/src/mesa/drivers/dri/r300/compiler/r300_fragprog_emit.c
1321 +++ b/src/mesa/drivers/dri/r300/compiler/r300_fragprog_emit.c
1322 @@ -76,6 +76,9 @@ static void use_temporary(struct r300_fragment_program_code *code, unsigned int
1323  
1324  static unsigned int use_source(struct r300_fragment_program_code* code, struct radeon_pair_instruction_source src)
1325  {
1326 +       if (!src.Used)
1327 +               return 0;
1328 +
1329         if (src.File == RC_FILE_CONSTANT) {
1330                 return src.Index | (1 << 5);
1331         } else if (src.File == RC_FILE_TEMPORARY) {
1332 diff --git a/src/mesa/drivers/dri/r300/compiler/r300_fragprog_swizzle.c b/src/mesa/drivers/dri/r300/compiler/r300_fragprog_swizzle.c
1333 index caa48fe..1aa40c7 100644
1334 --- a/src/mesa/drivers/dri/r300/compiler/r300_fragprog_swizzle.c
1335 +++ b/src/mesa/drivers/dri/r300/compiler/r300_fragprog_swizzle.c
1336 @@ -94,6 +94,10 @@ static const struct swizzle_data* lookup_native_swizzle(unsigned int swizzle)
1337   */
1338  static int r300_swizzle_is_native(rc_opcode opcode, struct rc_src_register reg)
1339  {
1340 +       const struct swizzle_data* sd;
1341 +       unsigned int relevant;
1342 +       int j;
1343 +
1344         if (reg.Abs)
1345                 reg.Negate = RC_MASK_NONE;
1346  
1347 @@ -117,8 +121,7 @@ static int r300_swizzle_is_native(rc_opcode opcode, struct rc_src_register reg)
1348                 return 1;
1349         }
1350  
1351 -       unsigned int relevant = 0;
1352 -       int j;
1353 +       relevant = 0;
1354  
1355         for(j = 0; j < 3; ++j)
1356                 if (GET_SWZ(reg.Swizzle, j) != RC_SWIZZLE_UNUSED)
1357 @@ -127,7 +130,8 @@ static int r300_swizzle_is_native(rc_opcode opcode, struct rc_src_register reg)
1358         if ((reg.Negate & relevant) && ((reg.Negate & relevant) != relevant))
1359                 return 0;
1360  
1361 -       if (!lookup_native_swizzle(reg.Swizzle))
1362 +       sd = lookup_native_swizzle(reg.Swizzle);
1363 +       if (!sd || (reg.File == RC_FILE_PRESUB && sd->srcp_stride == 0))
1364                 return 0;
1365  
1366         return 1;
1367 @@ -200,7 +204,7 @@ unsigned int r300FPTranslateRGBSwizzle(unsigned int src, unsigned int swizzle)
1368  {
1369         const struct swizzle_data* sd = lookup_native_swizzle(swizzle);
1370  
1371 -       if (!sd) {
1372 +       if (!sd || (src == RC_PAIR_PRESUB_SRC && sd->srcp_stride == 0)) {
1373                 fprintf(stderr, "Not a native swizzle: %08x\n", swizzle);
1374                 return 0;
1375         }
1376 diff --git a/src/mesa/drivers/dri/r300/compiler/r500_fragprog_emit.c b/src/mesa/drivers/dri/r300/compiler/r500_fragprog_emit.c
1377 index efa3bb5..abbf704 100644
1378 --- a/src/mesa/drivers/dri/r300/compiler/r500_fragprog_emit.c
1379 +++ b/src/mesa/drivers/dri/r300/compiler/r500_fragprog_emit.c
1380 @@ -200,6 +200,9 @@ static void use_temporary(struct r500_fragment_program_code* code, unsigned int
1381  
1382  static unsigned int use_source(struct r500_fragment_program_code* code, struct radeon_pair_instruction_source src)
1383  {
1384 +       if (!src.Used)
1385 +               return 0;
1386 +
1387         if (src.File == RC_FILE_CONSTANT) {
1388                 return src.Index | 0x100;
1389         } else if (src.File == RC_FILE_TEMPORARY) {
1390 diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_optimize.c b/src/mesa/drivers/dri/r300/compiler/radeon_optimize.c
1391 index 3be50b9..bebe806 100644
1392 --- a/src/mesa/drivers/dri/r300/compiler/radeon_optimize.c
1393 +++ b/src/mesa/drivers/dri/r300/compiler/radeon_optimize.c
1394 @@ -566,6 +566,7 @@ static int presub_helper(
1395                 for(i = 0; i < info->NumSrcRegs; i++) {
1396                         unsigned int mask = src_reads_dst_mask(
1397                                 inst->U.I.SrcReg[i], s->Inst->U.I.DstReg);
1398 +                       struct rc_src_register src = inst->U.I.SrcReg[i];
1399                         /* XXX We could be more aggressive here using
1400                          * presubtract.  It is okay if SrcReg[i] only reads
1401                          * from some of the mask components. */
1402 @@ -577,6 +578,11 @@ static int presub_helper(
1403                                         continue;
1404                                 }
1405                         }
1406 +                       src.File = RC_FILE_PRESUB;
1407 +                       if (!c->SwizzleCaps->IsNative(inst->U.I.Opcode, src)){
1408 +                               can_remove = 0;
1409 +                               break;
1410 +                       }
1411                         if (cant_sub || !can_use_presub) {
1412                                 can_remove = 0;
1413                                 break;
1414 @@ -635,7 +641,9 @@ static void presub_replace_add(struct peephole_state *s,
1415         inst->U.I.SrcReg[src_index].Index = presub_opcode;
1416  }
1417  
1418 -static int is_presub_candidate(struct rc_instruction * inst)
1419 +static int is_presub_candidate(
1420 +       struct radeon_compiler * c,
1421 +       struct rc_instruction * inst)
1422  {
1423         const struct rc_opcode_info * info = rc_get_opcode_info(inst->U.I.Opcode);
1424         unsigned int i;
1425 @@ -644,7 +652,12 @@ static int is_presub_candidate(struct rc_instruction * inst)
1426                 return 0;
1427  
1428         for(i = 0; i < info->NumSrcRegs; i++) {
1429 -               if (src_reads_dst_mask(inst->U.I.SrcReg[i], inst->U.I.DstReg))
1430 +               struct rc_src_register src = inst->U.I.SrcReg[i];
1431 +               if (src_reads_dst_mask(src, inst->U.I.DstReg))
1432 +                       return 0;
1433 +
1434 +               src.File = RC_FILE_PRESUB;
1435 +               if (!c->SwizzleCaps->IsNative(inst->U.I.Opcode, src))
1436                         return 0;
1437         }
1438         return 1;
1439 @@ -659,7 +672,7 @@ static int peephole_add_presub_add(
1440         unsigned int i;
1441         struct peephole_state s;
1442  
1443 -       if (!is_presub_candidate(inst_add))
1444 +       if (!is_presub_candidate(c, inst_add))
1445                 return 0;
1446  
1447         if (inst_add->U.I.SrcReg[0].Swizzle != inst_add->U.I.SrcReg[1].Swizzle)
1448 @@ -726,7 +739,7 @@ static int peephole_add_presub_inv(
1449         unsigned int i, swz, mask;
1450         struct peephole_state s;
1451  
1452 -       if (!is_presub_candidate(inst_add))
1453 +       if (!is_presub_candidate(c, inst_add))
1454                 return 0;
1455  
1456         mask = inst_add->U.I.DstReg.WriteMask;
1457 diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_pair_regalloc.c b/src/mesa/drivers/dri/r300/compiler/radeon_pair_regalloc.c
1458 index c738455..126b50b 100644
1459 --- a/src/mesa/drivers/dri/r300/compiler/radeon_pair_regalloc.c
1460 +++ b/src/mesa/drivers/dri/r300/compiler/radeon_pair_regalloc.c
1461 @@ -66,10 +66,13 @@ struct regalloc_state {
1462         struct hardware_register * HwTemporary;
1463         unsigned int NumHwTemporaries;
1464         /**
1465 -        * If an instruction is inside of a loop, end_loop will be the
1466 -        * IP of the ENDLOOP instruction, otherwise end_loop will be 0
1467 +        * If an instruction is inside of a loop, EndLoop will be the
1468 +        * IP of the ENDLOOP instruction, and BeginLoop will be the IP
1469 +        * of the BGNLOOP instruction.  Otherwise, EndLoop and BeginLoop
1470 +        * will be -1.
1471          */
1472 -       int end_loop;
1473 +       int EndLoop;
1474 +       int BeginLoop;
1475  };
1476  
1477  static void print_live_intervals(struct live_intervals * src)
1478 @@ -180,11 +183,13 @@ static void scan_callback(void * data, struct rc_instruction * inst,
1479                 reg->Used = 1;
1480                 if (file == RC_FILE_INPUT)
1481                         reg->Live.Start = -1;
1482 +               else if (s->BeginLoop >= 0)
1483 +                       reg->Live.Start = s->BeginLoop;
1484                 else
1485                         reg->Live.Start = inst->IP;
1486                 reg->Live.End = inst->IP;
1487 -       } else if (s->end_loop)
1488 -               reg->Live.End = s->end_loop;
1489 +       } else if (s->EndLoop >= 0)
1490 +               reg->Live.End = s->EndLoop;
1491         else if (inst->IP > reg->Live.End)
1492                 reg->Live.End = inst->IP;
1493  }
1494 @@ -195,6 +200,8 @@ static void compute_live_intervals(struct radeon_compiler *c,
1495         memset(s, 0, sizeof(*s));
1496         s->C = c;
1497         s->NumHwTemporaries = c->max_temp_regs;
1498 +       s->BeginLoop = -1;
1499 +       s->EndLoop = -1;
1500         s->HwTemporary =
1501                 memory_pool_malloc(&c->Pool,
1502                                    s->NumHwTemporaries * sizeof(struct hardware_register));
1503 @@ -207,8 +214,10 @@ static void compute_live_intervals(struct radeon_compiler *c,
1504             inst = inst->Next) {
1505  
1506                 /* For all instructions inside of a loop, the ENDLOOP
1507 -                * instruction is used as the end of the live interval. */
1508 -               if (inst->U.I.Opcode == RC_OPCODE_BGNLOOP && !s->end_loop) {
1509 +                * instruction is used as the end of the live interval and
1510 +                * the BGNLOOP instruction is used as the beginning. */
1511 +               if (inst->U.I.Opcode == RC_OPCODE_BGNLOOP && s->EndLoop < 0) {
1512 +                       s->BeginLoop = inst->IP;
1513                         int loops = 1;
1514                         struct rc_instruction * tmp;
1515                         for(tmp = inst->Next;
1516 @@ -219,15 +228,17 @@ static void compute_live_intervals(struct radeon_compiler *c,
1517                                 } else if (tmp->U.I.Opcode
1518                                                         == RC_OPCODE_ENDLOOP) {
1519                                         if(!--loops) {
1520 -                                               s->end_loop = tmp->IP;
1521 +                                               s->EndLoop = tmp->IP;
1522                                                 break;
1523                                         }
1524                                 }
1525                         }
1526                 }
1527  
1528 -               if (inst->IP == s->end_loop)
1529 -                       s->end_loop = 0;
1530 +               if (inst->IP == s->EndLoop) {
1531 +                       s->EndLoop = -1;
1532 +                       s->BeginLoop = -1;
1533 +               }
1534  
1535                 rc_for_all_reads_mask(inst, scan_callback, s);
1536                 rc_for_all_writes_mask(inst, scan_callback, s);
1537 diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_pair_schedule.c b/src/mesa/drivers/dri/r300/compiler/radeon_pair_schedule.c
1538 index 7ab2df3..0b003d7 100644
1539 --- a/src/mesa/drivers/dri/r300/compiler/radeon_pair_schedule.c
1540 +++ b/src/mesa/drivers/dri/r300/compiler/radeon_pair_schedule.c
1541 @@ -126,15 +126,6 @@ static struct reg_value ** get_reg_valuep(struct schedule_state * s,
1542         return &s->Temporary[index].Values[chan];
1543  }
1544  
1545 -static struct reg_value * get_reg_value(struct schedule_state * s,
1546 -               rc_register_file file, unsigned int index, unsigned int chan)
1547 -{
1548 -       struct reg_value ** pv = get_reg_valuep(s, file, index, chan);
1549 -       if (!pv)
1550 -               return 0;
1551 -       return *pv;
1552 -}
1553 -
1554  static void add_inst_to_list(struct schedule_instruction ** list, struct schedule_instruction * inst)
1555  {
1556         inst->NextReady = *list;
1557 @@ -602,12 +593,13 @@ static void scan_read(void * data, struct rc_instruction * inst,
1558                 rc_register_file file, unsigned int index, unsigned int chan)
1559  {
1560         struct schedule_state * s = data;
1561 -       struct reg_value * v = get_reg_value(s, file, index, chan);
1562 +       struct reg_value ** v = get_reg_valuep(s, file, index, chan);
1563 +       struct reg_value_reader * reader;
1564  
1565         if (!v)
1566                 return;
1567  
1568 -       if (v->Writer == s->Current) {
1569 +       if (*v && (*v)->Writer == s->Current) {
1570                 /* The instruction reads and writes to a register component.
1571                  * In this case, we only want to increment dependencies by one.
1572                  */
1573 @@ -616,18 +608,30 @@ static void scan_read(void * data, struct rc_instruction * inst,
1574  
1575         DBG("%i: read %i[%i] chan %i\n", s->Current->Instruction->IP, file, index, chan);
1576  
1577 -       struct reg_value_reader * reader = memory_pool_malloc(&s->C->Pool, sizeof(*reader));
1578 +       reader = memory_pool_malloc(&s->C->Pool, sizeof(*reader));
1579         reader->Reader = s->Current;
1580 -       reader->Next = v->Readers;
1581 -       v->Readers = reader;
1582 -       v->NumReaders++;
1583 -
1584 -       s->Current->NumDependencies++;
1585 +       if (!*v) {
1586 +               /* In this situation, the instruction reads from a register
1587 +                * that hasn't been written to or read from in the current
1588 +                * block. */
1589 +               *v = memory_pool_malloc(&s->C->Pool, sizeof(struct reg_value));
1590 +               memset(*v, 0, sizeof(struct reg_value));
1591 +               (*v)->Readers = reader;
1592 +       } else {
1593 +               reader->Next = (*v)->Readers;
1594 +               (*v)->Readers = reader;
1595 +               /* Only update the current instruction's dependencies if the
1596 +                * register it reads from has been written to in this block. */
1597 +               if ((*v)->Writer) {
1598 +                       s->Current->NumDependencies++;
1599 +               }
1600 +       }
1601 +       (*v)->NumReaders++;
1602  
1603         if (s->Current->NumReadValues >= 12) {
1604                 rc_error(s->C, "%s: NumReadValues overflow\n", __FUNCTION__);
1605         } else {
1606 -               s->Current->ReadValues[s->Current->NumReadValues++] = v;
1607 +               s->Current->ReadValues[s->Current->NumReadValues++] = *v;
1608         }
1609  }
1610  
1611 diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_pair_translate.c b/src/mesa/drivers/dri/r300/compiler/radeon_pair_translate.c
1612 index ff82584..840c7a5 100644
1613 --- a/src/mesa/drivers/dri/r300/compiler/radeon_pair_translate.c
1614 +++ b/src/mesa/drivers/dri/r300/compiler/radeon_pair_translate.c
1615 @@ -278,9 +278,12 @@ static void set_pair_instruction(struct r300_fragment_program_compiler *c,
1616                         pair->RGB.DestIndex = inst->DstReg.Index;
1617                         pair->RGB.WriteMask |= inst->DstReg.WriteMask & RC_MASK_XYZ;
1618                 }
1619 +
1620                 if (needalpha) {
1621 -                       pair->Alpha.DestIndex = inst->DstReg.Index;
1622                         pair->Alpha.WriteMask |= GET_BIT(inst->DstReg.WriteMask, 3);
1623 +                       if (pair->Alpha.WriteMask) {
1624 +                               pair->Alpha.DestIndex = inst->DstReg.Index;
1625 +                       }
1626                 }
1627         }
1628  
1629 diff --git a/src/mesa/drivers/dri/r300/r300_draw.c b/src/mesa/drivers/dri/r300/r300_draw.c
1630 index 5ae9f49..767778b 100644
1631 --- a/src/mesa/drivers/dri/r300/r300_draw.c
1632 +++ b/src/mesa/drivers/dri/r300/r300_draw.c
1633 @@ -717,6 +717,10 @@ static void r300DrawPrims(GLcontext *ctx,
1634                          GLuint max_index)
1635  {
1636         GLboolean retval;
1637 +       struct r300_context *r300 = R300_CONTEXT(ctx);
1638 +       radeonContextPtr radeon = &r300->radeon;
1639 +
1640 +       radeon_prepare_render(radeon);
1641  
1642         /* This check should get folded into just the places that
1643          * min/max index are really needed.
1644 diff --git a/src/mesa/drivers/dri/r300/r300_render.c b/src/mesa/drivers/dri/r300/r300_render.c
1645 index cf89ab7..bb8f914 100644
1646 --- a/src/mesa/drivers/dri/r300/r300_render.c
1647 +++ b/src/mesa/drivers/dri/r300/r300_render.c
1648 @@ -327,8 +327,6 @@ void r300RunRenderPrimitive(GLcontext * ctx, int start, int end, int prim)
1649         BATCH_LOCALS(&rmesa->radeon);
1650         int type, num_verts;
1651  
1652 -       radeon_prepare_render(&rmesa->radeon);
1653 -
1654         type = r300PrimitiveType(rmesa, prim);
1655         num_verts = r300NumVerts(rmesa, end - start, prim);
1656  
1657 diff --git a/src/mesa/drivers/dri/r600/evergreen_render.c b/src/mesa/drivers/dri/r600/evergreen_render.c
1658 index 27089bf..1fa53d7 100644
1659 --- a/src/mesa/drivers/dri/r600/evergreen_render.c
1660 +++ b/src/mesa/drivers/dri/r600/evergreen_render.c
1661 @@ -909,6 +909,10 @@ static void evergreenDrawPrims(GLcontext *ctx,
1662  {
1663         GLboolean retval = GL_FALSE;
1664  
1665 +       context_t *context = EVERGREEN_CONTEXT(ctx);
1666 +       radeonContextPtr radeon = &context->radeon;
1667 +       radeon_prepare_render(radeon);
1668 +
1669         /* This check should get folded into just the places that
1670          * min/max index are really needed.
1671          */
1672 diff --git a/src/mesa/drivers/dri/radeon/radeon_common_context.c b/src/mesa/drivers/dri/radeon/radeon_common_context.c
1673 index 85e4988..d4c7864 100644
1674 --- a/src/mesa/drivers/dri/radeon/radeon_common_context.c
1675 +++ b/src/mesa/drivers/dri/radeon/radeon_common_context.c
1676 @@ -251,9 +251,9 @@ GLboolean radeonInitContext(radeonContextPtr radeon,
1677                         radeon->texture_rect_row_align = 512;
1678                         radeon->texture_compressed_row_align = 512;
1679                 } else {
1680 -                       radeon->texture_row_align = 256;
1681 -                       radeon->texture_rect_row_align = 256;
1682 -                       radeon->texture_compressed_row_align = 256;
1683 +                       radeon->texture_row_align = radeon->radeonScreen->group_bytes;
1684 +                       radeon->texture_rect_row_align = radeon->radeonScreen->group_bytes;
1685 +                       radeon->texture_compressed_row_align = radeon->radeonScreen->group_bytes;
1686                 }
1687         } else if (IS_R200_CLASS(radeon->radeonScreen) ||
1688                    IS_R100_CLASS(radeon->radeonScreen)) {
1689 @@ -521,6 +521,7 @@ void radeon_prepare_render(radeonContextPtr radeon)
1690      __DRIcontext *driContext = radeon->dri.context;
1691      __DRIdrawable *drawable;
1692      __DRIscreen *screen;
1693 +    struct radeon_framebuffer *draw;
1694  
1695      screen = driContext->driScreenPriv;
1696      if (!screen->dri2.loader)
1697 @@ -531,9 +532,10 @@ void radeon_prepare_render(radeonContextPtr radeon)
1698         if (drawable->lastStamp != drawable->dri2.stamp)
1699             radeon_update_renderbuffers(driContext, drawable, GL_FALSE);
1700  
1701 -       /* Intel driver does the equivalent of this, no clue if it is needed:
1702 -        * radeon_draw_buffer(radeon->glCtx, &(drawable->driverPrivate)->base);
1703 -        */
1704 +       /* Intel driver does the equivalent of this, no clue if it is needed:*/
1705 +       draw = drawable->driverPrivate;
1706 +       radeon_draw_buffer(radeon->glCtx, &draw->base);
1707 +
1708         driContext->dri2.draw_stamp = drawable->dri2.stamp;
1709      }
1710  
1711 @@ -738,10 +740,9 @@ radeon_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable,
1712                                                 buffers[i].flags);
1713  
1714                         if (bo == NULL) {
1715 -
1716                                 fprintf(stderr, "failed to attach %s %d\n",
1717                                         regname, buffers[i].name);
1718 -
1719 +                               continue;
1720                         }
1721  
1722                         ret = radeon_bo_get_tiling(bo, &tiling_flags, &pitch);
1723 diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c
1724 index 2ea77e5..0ca052d 100644
1725 --- a/src/mesa/drivers/dri/radeon/radeon_screen.c
1726 +++ b/src/mesa/drivers/dri/radeon/radeon_screen.c
1727 @@ -1138,6 +1138,8 @@ radeonCreateScreen( __DRIscreen *sPriv )
1728     else
1729            screen->chip_flags |= RADEON_CLASS_R600;
1730  
1731 +   /* set group bytes for r6xx+ */
1732 +   screen->group_bytes = 256;
1733     screen->cpp = dri_priv->bpp / 8;
1734     screen->AGPMode = dri_priv->AGPMode;
1735  
1736 @@ -1382,7 +1384,8 @@ radeonCreateScreen2(__DRIscreen *sPriv)
1737     else
1738            screen->chip_flags |= RADEON_CLASS_R600;
1739  
1740 -   /* r6xx+ tiling */
1741 +   /* r6xx+ tiling, default to 256 group bytes */
1742 +   screen->group_bytes = 256;
1743     if (IS_R600_CLASS(screen) && (sPriv->drm_version.minor >= 6)) {
1744            ret = radeonGetParam(sPriv, RADEON_INFO_TILE_CONFIG, &temp);
1745            if (ret)
1746 diff --git a/src/mesa/drivers/dri/radeon/radeon_swtcl.c b/src/mesa/drivers/dri/radeon/radeon_swtcl.c
1747 index 29defe7..0a81843 100644
1748 --- a/src/mesa/drivers/dri/radeon/radeon_swtcl.c
1749 +++ b/src/mesa/drivers/dri/radeon/radeon_swtcl.c
1750 @@ -412,6 +412,8 @@ static GLboolean radeon_run_render( GLcontext *ctx,
1751        return GL_TRUE;          
1752  
1753     radeon_prepare_render(&rmesa->radeon);
1754 +   if (rmesa->radeon.NewGLState)
1755 +      radeonValidateState( ctx );
1756  
1757     tnl->Driver.Render.Start( ctx );
1758  
1759 diff --git a/src/mesa/drivers/dri/radeon/radeon_tcl.c b/src/mesa/drivers/dri/radeon/radeon_tcl.c
1760 index 5e1718f..ded3ebe 100644
1761 --- a/src/mesa/drivers/dri/radeon/radeon_tcl.c
1762 +++ b/src/mesa/drivers/dri/radeon/radeon_tcl.c
1763 @@ -253,6 +253,8 @@ void radeonTclPrimitive( GLcontext *ctx,
1764     GLuint newprim = hw_prim | RADEON_CP_VC_CNTL_TCL_ENABLE;
1765  
1766     radeon_prepare_render(&rmesa->radeon);
1767 +   if (rmesa->radeon.NewGLState)
1768 +      radeonValidateState( ctx );
1769  
1770     if (newprim != rmesa->tcl.hw_primitive ||
1771         !discrete_prim[hw_prim&0xf]) {
1772 diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
1773 index 4797f29..d9eaada 100644
1774 --- a/src/mesa/main/bufferobj.c
1775 +++ b/src/mesa/main/bufferobj.c
1776 @@ -55,6 +55,13 @@
1777  
1778  
1779  /**
1780 + * Used as a placeholder for buffer objects between glGenBuffers() and
1781 + * glBindBuffer() so that glIsBuffer() can work correctly.
1782 + */
1783 +static struct gl_buffer_object DummyBufferObject;
1784 +
1785 +
1786 +/**
1787   * Return pointer to address of a buffer object target.
1788   * \param ctx  the GL context
1789   * \param target  the buffer object target to be retrieved.
1790 @@ -554,6 +561,9 @@ _mesa_copy_buffer_subdata(GLcontext *ctx,
1791  void
1792  _mesa_init_buffer_objects( GLcontext *ctx )
1793  {
1794 +   memset(&DummyBufferObject, 0, sizeof(DummyBufferObject));
1795 +   DummyBufferObject.RefCount = 1000*1000*1000; /* never delete */
1796 +
1797     _mesa_reference_buffer_object(ctx, &ctx->Array.ArrayBufferObj,
1798                                   ctx->Shared->NullBufferObj);
1799     _mesa_reference_buffer_object(ctx, &ctx->Array.ElementArrayBufferObj,
1800 @@ -611,8 +621,10 @@ bind_buffer_object(GLcontext *ctx, GLenum target, GLuint buffer)
1801     else {
1802        /* non-default buffer object */
1803        newBufObj = _mesa_lookup_bufferobj(ctx, buffer);
1804 -      if (!newBufObj) {
1805 -         /* if this is a new buffer object id, allocate a buffer object now */
1806 +      if (!newBufObj || newBufObj == &DummyBufferObject) {
1807 +         /* If this is a new buffer object id, or one which was generated but
1808 +          * never used before, allocate a buffer object now.
1809 +          */
1810           ASSERT(ctx->Driver.NewBufferObject);
1811           newBufObj = ctx->Driver.NewBufferObject(ctx, buffer, target);
1812           if (!newBufObj) {
1813 @@ -992,7 +1004,7 @@ _mesa_DeleteBuffersARB(GLsizei n, const GLuint *ids)
1814           struct gl_array_object *arrayObj = ctx->Array.ArrayObj;
1815           GLuint j;
1816  
1817 -         ASSERT(bufObj->Name == ids[i]);
1818 +         ASSERT(bufObj->Name == ids[i] || bufObj == &DummyBufferObject);
1819  
1820           if (_mesa_bufferobj_mapped(bufObj)) {
1821              /* if mapped, unmap it now */
1822 @@ -1033,7 +1045,7 @@ _mesa_DeleteBuffersARB(GLsizei n, const GLuint *ids)
1823           }
1824  
1825           /* The ID is immediately freed for re-use */
1826 -         _mesa_HashRemove(ctx->Shared->BufferObjects, bufObj->Name);
1827 +         _mesa_HashRemove(ctx->Shared->BufferObjects, ids[i]);
1828           _mesa_reference_buffer_object(ctx, &bufObj, NULL);
1829        }
1830     }
1831 @@ -1072,18 +1084,10 @@ _mesa_GenBuffersARB(GLsizei n, GLuint *buffer)
1832  
1833     first = _mesa_HashFindFreeKeyBlock(ctx->Shared->BufferObjects, n);
1834  
1835 -   /* Allocate new, empty buffer objects and return identifiers */
1836 +   /* Insert the ID and pointer to dummy buffer object into hash table */
1837     for (i = 0; i < n; i++) {
1838 -      struct gl_buffer_object *bufObj;
1839 -      GLuint name = first + i;
1840 -      GLenum target = 0;
1841 -      bufObj = ctx->Driver.NewBufferObject( ctx, name, target );
1842 -      if (!bufObj) {
1843 -         _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex);
1844 -         _mesa_error(ctx, GL_OUT_OF_MEMORY, "glGenBuffersARB");
1845 -         return;
1846 -      }
1847 -      _mesa_HashInsert(ctx->Shared->BufferObjects, first + i, bufObj);
1848 +      _mesa_HashInsert(ctx->Shared->BufferObjects, first + i,
1849 +                       &DummyBufferObject);
1850        buffer[i] = first + i;
1851     }
1852  
1853 @@ -1109,7 +1113,7 @@ _mesa_IsBufferARB(GLuint id)
1854     bufObj = _mesa_lookup_bufferobj(ctx, id);
1855     _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex);
1856  
1857 -   return bufObj ? GL_TRUE : GL_FALSE;
1858 +   return bufObj && bufObj != &DummyBufferObject;
1859  }
1860  
1861  
1862 diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c
1863 index 9db9f1c..c3fe8a3 100644
1864 --- a/src/mesa/main/formats.c
1865 +++ b/src/mesa/main/formats.c
1866 @@ -1109,6 +1109,7 @@ _mesa_format_to_type_and_comps(gl_format format,
1867     case MESA_FORMAT_ARGB8888:
1868     case MESA_FORMAT_ARGB8888_REV:
1869     case MESA_FORMAT_XRGB8888:
1870 +   case MESA_FORMAT_XRGB8888_REV:
1871        *datatype = GL_UNSIGNED_BYTE;
1872        *comps = 4;
1873        return;
1874 @@ -1135,6 +1136,11 @@ _mesa_format_to_type_and_comps(gl_format format,
1875        *comps = 4;
1876        return;
1877  
1878 +   case MESA_FORMAT_RGBA5551:
1879 +      *datatype = GL_UNSIGNED_SHORT_5_5_5_1;
1880 +      *comps = 4;
1881 +      return;
1882 +
1883     case MESA_FORMAT_AL88:
1884     case MESA_FORMAT_AL88_REV:
1885        *datatype = GL_UNSIGNED_BYTE;
1886 @@ -1156,6 +1162,7 @@ _mesa_format_to_type_and_comps(gl_format format,
1887     case MESA_FORMAT_L8:
1888     case MESA_FORMAT_I8:
1889     case MESA_FORMAT_CI8:
1890 +   case MESA_FORMAT_S8:
1891        *datatype = GL_UNSIGNED_BYTE;
1892        *comps = 1;
1893        return;
1894 @@ -1201,12 +1208,26 @@ _mesa_format_to_type_and_comps(gl_format format,
1895        *comps = 2;
1896        return;
1897  
1898 +   case MESA_FORMAT_SIGNED_R8:
1899 +      *datatype = GL_BYTE;
1900 +      *comps = 1;
1901 +      return;
1902 +   case MESA_FORMAT_SIGNED_RG88:
1903 +      *datatype = GL_BYTE;
1904 +      *comps = 2;
1905 +      return;
1906     case MESA_FORMAT_SIGNED_RGBA8888:
1907     case MESA_FORMAT_SIGNED_RGBA8888_REV:
1908 +   case MESA_FORMAT_SIGNED_RGBX8888:
1909        *datatype = GL_BYTE;
1910        *comps = 4;
1911        return;
1912  
1913 +   case MESA_FORMAT_RGBA_16:
1914 +      *datatype = GL_UNSIGNED_SHORT;
1915 +      *comps = 4;
1916 +      return;
1917 +
1918     case MESA_FORMAT_SIGNED_R_16:
1919        *datatype = GL_SHORT;
1920        *comps = 1;
1921 @@ -1331,9 +1352,14 @@ _mesa_format_to_type_and_comps(gl_format format,
1922        *comps = 4;
1923        return;
1924  
1925 -
1926 +   case MESA_FORMAT_NONE:
1927 +   case MESA_FORMAT_COUNT:
1928 +   /* For debug builds, warn if any formats are not handled */
1929 +#ifndef DEBUG
1930     default:
1931 -      _mesa_problem(NULL, "bad format in _mesa_format_to_type_and_comps");
1932 +#endif
1933 +      _mesa_problem(NULL, "bad format %s in _mesa_format_to_type_and_comps",
1934 +                    _mesa_get_format_name(format));
1935        *datatype = 0;
1936        *comps = 1;
1937     }
1938 diff --git a/src/mesa/main/imports.c b/src/mesa/main/imports.c
1939 index 46e5c93..13dabde 100644
1940 --- a/src/mesa/main/imports.c
1941 +++ b/src/mesa/main/imports.c
1942 @@ -88,7 +88,8 @@ _mesa_align_malloc(size_t bytes, unsigned long alignment)
1943  #if defined(HAVE_POSIX_MEMALIGN)
1944     void *mem;
1945     int err = posix_memalign(& mem, alignment, bytes);
1946 -   (void) err;
1947 +   if (err)
1948 +      return NULL;
1949     return mem;
1950  #elif defined(_WIN32) && defined(_MSC_VER)
1951     return _aligned_malloc(bytes, alignment);
1952 diff --git a/src/mesa/main/mipmap.c b/src/mesa/main/mipmap.c
1953 index 3d1a4c4..71aa8c2 100644
1954 --- a/src/mesa/main/mipmap.c
1955 +++ b/src/mesa/main/mipmap.c
1956 @@ -288,6 +288,54 @@ do_row(GLenum datatype, GLuint comps, GLint srcWidth,
1957           dst[i] = (rowA[j] + rowA[k] + rowB[j] + rowB[k]) / 4;
1958        }
1959     }
1960 +
1961 +   else if (datatype == GL_SHORT && comps == 4) {
1962 +      GLuint i, j, k;
1963 +      const GLshort(*rowA)[4] = (const GLshort(*)[4]) srcRowA;
1964 +      const GLshort(*rowB)[4] = (const GLshort(*)[4]) srcRowB;
1965 +      GLshort(*dst)[4] = (GLshort(*)[4]) dstRow;
1966 +      for (i = j = 0, k = k0; i < (GLuint) dstWidth;
1967 +           i++, j += colStride, k += colStride) {
1968 +         dst[i][0] = (rowA[j][0] + rowA[k][0] + rowB[j][0] + rowB[k][0]) / 4;
1969 +         dst[i][1] = (rowA[j][1] + rowA[k][1] + rowB[j][1] + rowB[k][1]) / 4;
1970 +         dst[i][2] = (rowA[j][2] + rowA[k][2] + rowB[j][2] + rowB[k][2]) / 4;
1971 +         dst[i][3] = (rowA[j][3] + rowA[k][3] + rowB[j][3] + rowB[k][3]) / 4;
1972 +      }
1973 +   }
1974 +   else if (datatype == GL_SHORT && comps == 3) {
1975 +      GLuint i, j, k;
1976 +      const GLshort(*rowA)[3] = (const GLshort(*)[3]) srcRowA;
1977 +      const GLshort(*rowB)[3] = (const GLshort(*)[3]) srcRowB;
1978 +      GLshort(*dst)[3] = (GLshort(*)[3]) dstRow;
1979 +      for (i = j = 0, k = k0; i < (GLuint) dstWidth;
1980 +           i++, j += colStride, k += colStride) {
1981 +         dst[i][0] = (rowA[j][0] + rowA[k][0] + rowB[j][0] + rowB[k][0]) / 4;
1982 +         dst[i][1] = (rowA[j][1] + rowA[k][1] + rowB[j][1] + rowB[k][1]) / 4;
1983 +         dst[i][2] = (rowA[j][2] + rowA[k][2] + rowB[j][2] + rowB[k][2]) / 4;
1984 +      }
1985 +   }
1986 +   else if (datatype == GL_SHORT && comps == 2) {
1987 +      GLuint i, j, k;
1988 +      const GLshort(*rowA)[2] = (const GLshort(*)[2]) srcRowA;
1989 +      const GLshort(*rowB)[2] = (const GLshort(*)[2]) srcRowB;
1990 +      GLshort(*dst)[2] = (GLshort(*)[2]) dstRow;
1991 +      for (i = j = 0, k = k0; i < (GLuint) dstWidth;
1992 +           i++, j += colStride, k += colStride) {
1993 +         dst[i][0] = (rowA[j][0] + rowA[k][0] + rowB[j][0] + rowB[k][0]) / 4;
1994 +         dst[i][1] = (rowA[j][1] + rowA[k][1] + rowB[j][1] + rowB[k][1]) / 4;
1995 +      }
1996 +   }
1997 +   else if (datatype == GL_SHORT && comps == 1) {
1998 +      GLuint i, j, k;
1999 +      const GLshort *rowA = (const GLshort *) srcRowA;
2000 +      const GLshort *rowB = (const GLshort *) srcRowB;
2001 +      GLshort *dst = (GLshort *) dstRow;
2002 +      for (i = j = 0, k = k0; i < (GLuint) dstWidth;
2003 +           i++, j += colStride, k += colStride) {
2004 +         dst[i] = (rowA[j] + rowA[k] + rowB[j] + rowB[k]) / 4;
2005 +      }
2006 +   }
2007 +
2008     else if (datatype == GL_FLOAT && comps == 4) {
2009        GLuint i, j, k;
2010        const GLfloat(*rowA)[4] = (const GLfloat(*)[4]) srcRowA;
2011 @@ -507,6 +555,37 @@ do_row(GLenum datatype, GLuint comps, GLint srcWidth,
2012           dst[i] = (alpha << 15) | (blue << 10) | (green << 5) | red;
2013        }
2014     }
2015 +   else if (datatype == GL_UNSIGNED_SHORT_5_5_5_1 && comps == 4) {
2016 +      GLuint i, j, k;
2017 +      const GLushort *rowA = (const GLushort *) srcRowA;
2018 +      const GLushort *rowB = (const GLushort *) srcRowB;
2019 +      GLushort *dst = (GLushort *) dstRow;
2020 +      for (i = j = 0, k = k0; i < (GLuint) dstWidth;
2021 +           i++, j += colStride, k += colStride) {
2022 +         const GLint rowAr0 = (rowA[j] >> 11) & 0x1f;
2023 +         const GLint rowAr1 = (rowA[k] >> 11) & 0x1f;
2024 +         const GLint rowBr0 = (rowB[j] >> 11) & 0x1f;
2025 +         const GLint rowBr1 = (rowB[k] >> 11) & 0x1f;
2026 +         const GLint rowAg0 = (rowA[j] >> 6) & 0x1f;
2027 +         const GLint rowAg1 = (rowA[k] >> 6) & 0x1f;
2028 +         const GLint rowBg0 = (rowB[j] >> 6) & 0x1f;
2029 +         const GLint rowBg1 = (rowB[k] >> 6) & 0x1f;
2030 +         const GLint rowAb0 = (rowA[j] >> 1) & 0x1f;
2031 +         const GLint rowAb1 = (rowA[k] >> 1) & 0x1f;
2032 +         const GLint rowBb0 = (rowB[j] >> 1) & 0x1f;
2033 +         const GLint rowBb1 = (rowB[k] >> 1) & 0x1f;
2034 +         const GLint rowAa0 = (rowA[j] & 0x1);
2035 +         const GLint rowAa1 = (rowA[k] & 0x1);
2036 +         const GLint rowBa0 = (rowB[j] & 0x1);
2037 +         const GLint rowBa1 = (rowB[k] & 0x1);
2038 +         const GLint red = (rowAr0 + rowAr1 + rowBr0 + rowBr1) >> 2;
2039 +         const GLint green = (rowAg0 + rowAg1 + rowBg0 + rowBg1) >> 2;
2040 +         const GLint blue = (rowAb0 + rowAb1 + rowBb0 + rowBb1) >> 2;
2041 +         const GLint alpha = (rowAa0 + rowAa1 + rowBa0 + rowBa1) >> 2;
2042 +         dst[i] = (red << 11) | (green << 6) | (blue << 1) | alpha;
2043 +      }
2044 +   }
2045 +
2046     else if (datatype == GL_UNSIGNED_BYTE_3_3_2 && comps == 3) {
2047        GLuint i, j, k;
2048        const GLubyte *rowA = (const GLubyte *) srcRowA;
2049 @@ -606,7 +685,7 @@ do_row_3D(GLenum datatype, GLuint comps, GLint srcWidth,
2050           FILTER_3D(0);
2051        }
2052     }
2053 -   if ((datatype == GL_BYTE) && (comps == 4)) {
2054 +   else if ((datatype == GL_BYTE) && (comps == 4)) {
2055        DECLARE_ROW_POINTERS(GLbyte, 4);
2056  
2057        for (i = j = 0, k = k0; i < (GLuint) dstWidth;
2058 @@ -682,6 +761,44 @@ do_row_3D(GLenum datatype, GLuint comps, GLint srcWidth,
2059           FILTER_3D(0);
2060        }
2061     }
2062 +   else if ((datatype == GL_SHORT) && (comps == 4)) {
2063 +      DECLARE_ROW_POINTERS(GLshort, 4);
2064 +
2065 +      for (i = j = 0, k = k0; i < (GLuint) dstWidth;
2066 +           i++, j += colStride, k += colStride) {
2067 +         FILTER_3D(0);
2068 +         FILTER_3D(1);
2069 +         FILTER_3D(2);
2070 +         FILTER_3D(3);
2071 +      }
2072 +   }
2073 +   else if ((datatype == GL_SHORT) && (comps == 3)) {
2074 +      DECLARE_ROW_POINTERS(GLshort, 3);
2075 +
2076 +      for (i = j = 0, k = k0; i < (GLuint) dstWidth;
2077 +           i++, j += colStride, k += colStride) {
2078 +         FILTER_3D(0);
2079 +         FILTER_3D(1);
2080 +         FILTER_3D(2);
2081 +      }
2082 +   }
2083 +   else if ((datatype == GL_SHORT) && (comps == 2)) {
2084 +      DECLARE_ROW_POINTERS(GLshort, 2);
2085 +
2086 +      for (i = j = 0, k = k0; i < (GLuint) dstWidth;
2087 +           i++, j += colStride, k += colStride) {
2088 +         FILTER_3D(0);
2089 +         FILTER_3D(1);
2090 +      }
2091 +   }
2092 +   else if ((datatype == GL_SHORT) && (comps == 1)) {
2093 +      DECLARE_ROW_POINTERS(GLshort, 1);
2094 +
2095 +      for (i = j = 0, k = k0; i < (GLuint) dstWidth;
2096 +           i++, j += colStride, k += colStride) {
2097 +         FILTER_3D(0);
2098 +      }
2099 +   }
2100     else if ((datatype == GL_FLOAT) && (comps == 4)) {
2101        DECLARE_ROW_POINTERS(GLfloat, 4);
2102  
2103 @@ -910,6 +1027,55 @@ do_row_3D(GLenum datatype, GLuint comps, GLint srcWidth,
2104           dst[i] = (a << 15) | (b << 10) | (g << 5) | r;
2105        }
2106     }
2107 +   else if ((datatype == GL_UNSIGNED_SHORT_5_5_5_1) && (comps == 4)) {
2108 +      DECLARE_ROW_POINTERS0(GLushort);
2109 +
2110 +      for (i = j = 0, k = k0; i < (GLuint) dstWidth;
2111 +           i++, j += colStride, k += colStride) {
2112 +         const GLint rowAr0 = (rowA[j] >> 11) & 0x1f;
2113 +         const GLint rowAr1 = (rowA[k] >> 11) & 0x1f;
2114 +         const GLint rowBr0 = (rowB[j] >> 11) & 0x1f;
2115 +         const GLint rowBr1 = (rowB[k] >> 11) & 0x1f;
2116 +         const GLint rowCr0 = (rowC[j] >> 11) & 0x1f;
2117 +         const GLint rowCr1 = (rowC[k] >> 11) & 0x1f;
2118 +         const GLint rowDr0 = (rowD[j] >> 11) & 0x1f;
2119 +         const GLint rowDr1 = (rowD[k] >> 11) & 0x1f;
2120 +         const GLint rowAg0 = (rowA[j] >> 6) & 0x1f;
2121 +         const GLint rowAg1 = (rowA[k] >> 6) & 0x1f;
2122 +         const GLint rowBg0 = (rowB[j] >> 6) & 0x1f;
2123 +         const GLint rowBg1 = (rowB[k] >> 6) & 0x1f;
2124 +         const GLint rowCg0 = (rowC[j] >> 6) & 0x1f;
2125 +         const GLint rowCg1 = (rowC[k] >> 6) & 0x1f;
2126 +         const GLint rowDg0 = (rowD[j] >> 6) & 0x1f;
2127 +         const GLint rowDg1 = (rowD[k] >> 6) & 0x1f;
2128 +         const GLint rowAb0 = (rowA[j] >> 1) & 0x1f;
2129 +         const GLint rowAb1 = (rowA[k] >> 1) & 0x1f;
2130 +         const GLint rowBb0 = (rowB[j] >> 1) & 0x1f;
2131 +         const GLint rowBb1 = (rowB[k] >> 1) & 0x1f;
2132 +         const GLint rowCb0 = (rowC[j] >> 1) & 0x1f;
2133 +         const GLint rowCb1 = (rowC[k] >> 1) & 0x1f;
2134 +         const GLint rowDb0 = (rowD[j] >> 1) & 0x1f;
2135 +         const GLint rowDb1 = (rowD[k] >> 1) & 0x1f;
2136 +         const GLint rowAa0 = (rowA[j] & 0x1);
2137 +         const GLint rowAa1 = (rowA[k] & 0x1);
2138 +         const GLint rowBa0 = (rowB[j] & 0x1);
2139 +         const GLint rowBa1 = (rowB[k] & 0x1);
2140 +         const GLint rowCa0 = (rowC[j] & 0x1);
2141 +         const GLint rowCa1 = (rowC[k] & 0x1);
2142 +         const GLint rowDa0 = (rowD[j] & 0x1);
2143 +         const GLint rowDa1 = (rowD[k] & 0x1);
2144 +         const GLint r = FILTER_SUM_3D(rowAr0, rowAr1, rowBr0, rowBr1,
2145 +                                       rowCr0, rowCr1, rowDr0, rowDr1);
2146 +         const GLint g = FILTER_SUM_3D(rowAg0, rowAg1, rowBg0, rowBg1,
2147 +                                       rowCg0, rowCg1, rowDg0, rowDg1);
2148 +         const GLint b = FILTER_SUM_3D(rowAb0, rowAb1, rowBb0, rowBb1,
2149 +                                       rowCb0, rowCb1, rowDb0, rowDb1);
2150 +         const GLint a = FILTER_SUM_3D(rowAa0, rowAa1, rowBa0, rowBa1,
2151 +                                       rowCa0, rowCa1, rowDa0, rowDa1);
2152 +
2153 +         dst[i] = (r << 11) | (g << 6) | (b << 1) | a;
2154 +      }
2155 +   }
2156     else if ((datatype == GL_UNSIGNED_BYTE_3_3_2) && (comps == 3)) {
2157        DECLARE_ROW_POINTERS0(GLushort);
2158  
2159 diff --git a/src/mesa/state_tracker/st_cb_bufferobjects.c b/src/mesa/state_tracker/st_cb_bufferobjects.c
2160 index 7991a93..50b352c 100644
2161 --- a/src/mesa/state_tracker/st_cb_bufferobjects.c
2162 +++ b/src/mesa/state_tracker/st_cb_bufferobjects.c
2163 @@ -211,6 +211,13 @@ st_bufferobj_data(GLcontext *ctx,
2164  
2165  
2166  /**
2167 + * Dummy data whose's pointer is used for zero size buffers or ranges.
2168 + */
2169 +static long st_bufferobj_zero_length = 0;
2170 +
2171 +
2172 +
2173 +/**
2174   * Called via glMapBufferARB().
2175   */
2176  static void *
2177 @@ -233,10 +240,16 @@ st_bufferobj_map(GLcontext *ctx, GLenum target, GLenum access,
2178        break;      
2179     }
2180  
2181 -   obj->Pointer = pipe_buffer_map(st_context(ctx)->pipe,
2182 -                                  st_obj->buffer,
2183 -                                  flags,
2184 -                                  &st_obj->transfer);
2185 +   /* Handle zero-size buffers here rather than in drivers */
2186 +   if (obj->Size == 0) {
2187 +      obj->Pointer = &st_bufferobj_zero_length;
2188 +   }
2189 +   else {
2190 +      obj->Pointer = pipe_buffer_map(st_context(ctx)->pipe,
2191 +                                     st_obj->buffer,
2192 +                                     flags,
2193 +                                     &st_obj->transfer);
2194 +   }
2195  
2196     if (obj->Pointer) {
2197        obj->Offset = 0;
2198 @@ -247,13 +260,6 @@ st_bufferobj_map(GLcontext *ctx, GLenum target, GLenum access,
2199  
2200  
2201  /**
2202 - * Dummy data whose's pointer is used for zero length ranges.
2203 - */
2204 -static long
2205 -st_bufferobj_zero_length_range = 0;
2206 -
2207 -
2208 -/**
2209   * Called via glMapBufferRange().
2210   */
2211  static void *
2212 @@ -293,7 +299,7 @@ st_bufferobj_map_range(GLcontext *ctx, GLenum target,
2213      * length range from the pipe driver.
2214      */
2215     if (!length) {
2216 -      obj->Pointer = &st_bufferobj_zero_length_range;
2217 +      obj->Pointer = &st_bufferobj_zero_length;
2218     }
2219     else {
2220        obj->Pointer = pipe_buffer_map_range(pipe, 
2221 diff --git a/src/mesa/state_tracker/st_cb_eglimage.c b/src/mesa/state_tracker/st_cb_eglimage.c
2222 index 3145416..c54baf4 100644
2223 --- a/src/mesa/state_tracker/st_cb_eglimage.c
2224 +++ b/src/mesa/state_tracker/st_cb_eglimage.c
2225 @@ -129,6 +129,7 @@ st_bind_surface(GLcontext *ctx, GLenum target,
2226  
2227     /* FIXME create a non-default sampler view from the pipe_surface? */
2228     pipe_resource_reference(&stObj->pt, ps->texture);
2229 +   pipe_sampler_view_reference(&stObj->sampler_view, NULL);
2230     pipe_resource_reference(&stImage->pt, stObj->pt);
2231  
2232     stObj->width0 = ps->width;
2233 diff --git a/src/mesa/state_tracker/st_manager.c b/src/mesa/state_tracker/st_manager.c
2234 index 66e32b4..cd418a0 100644
2235 --- a/src/mesa/state_tracker/st_manager.c
2236 +++ b/src/mesa/state_tracker/st_manager.c
2237 @@ -486,9 +486,18 @@ st_context_notify_invalid_framebuffer(struct st_context_iface *stctxi,
2238     stfb = st_ws_framebuffer(st->ctx->WinSysDrawBuffer);
2239     if (!stfb || stfb->iface != stfbi)
2240        stfb = st_ws_framebuffer(st->ctx->WinSysReadBuffer);
2241 -   assert(stfb && stfb->iface == stfbi);
2242  
2243 -   p_atomic_set(&stfb->revalidate, TRUE);
2244 +   if (stfb && stfb->iface == stfbi) {
2245 +      p_atomic_set(&stfb->revalidate, TRUE);
2246 +   }
2247 +   else {
2248 +      /* This function is probably getting called when we've detected a
2249 +       * change in a window's size but the currently bound context is
2250 +       * not bound to that window.
2251 +       * If the st_framebuffer_iface structure had a pointer to the
2252 +       * corresponding st_framebuffer we'd be able to handle this.
2253 +       */
2254 +   }
2255  }
2256  
2257  static void
2258 diff --git a/src/mesa/swrast/s_texfilter.c b/src/mesa/swrast/s_texfilter.c
2259 index 3fc554c..28063e0 100644
2260 --- a/src/mesa/swrast/s_texfilter.c
2261 +++ b/src/mesa/swrast/s_texfilter.c
2262 @@ -1368,6 +1368,7 @@ opt_sample_rgb_2d(GLcontext *ctx,
2263        rgba[k][RCOMP] = UBYTE_TO_FLOAT(texel[2]);
2264        rgba[k][GCOMP] = UBYTE_TO_FLOAT(texel[1]);
2265        rgba[k][BCOMP] = UBYTE_TO_FLOAT(texel[0]);
2266 +      rgba[k][ACOMP] = 1.0F;
2267     }
2268  }
2269  
2270 @@ -2972,11 +2973,16 @@ choose_depth_texture_level(const struct gl_texture_object *tObj, GLfloat lambda)
2271  {
2272     GLint level;
2273  
2274 -   lambda = CLAMP(lambda, tObj->MinLod, tObj->MaxLod);
2275 -
2276 -   level = (GLint) lambda;
2277 -
2278 -   level = CLAMP(level, tObj->BaseLevel, tObj->_MaxLevel);
2279 +   if (tObj->MinFilter == GL_NEAREST || tObj->MinFilter == GL_LINEAR) {
2280 +      /* no mipmapping - use base level */
2281 +      level = tObj->BaseLevel;
2282 +   }
2283 +   else {
2284 +      /* choose mipmap level */
2285 +      lambda = CLAMP(lambda, tObj->MinLod, tObj->MaxLod);
2286 +      level = (GLint) lambda;
2287 +      level = CLAMP(level, tObj->BaseLevel, tObj->_MaxLevel);
2288 +   }
2289  
2290     return level;
2291  }
This page took 0.80497 seconds and 3 git commands to generate.