1 diff --git a/Makefile b/Makefile
2 index b8069f9..b13ed33 100644
5 @@ -347,23 +347,19 @@ GALLIUM_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
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.
38 -Update the docs/news.html file and docs/download.html files.
39 +Update docs/news.html.
43 @@ -208,10 +208,11 @@ sftp USERNAME,mesa3d@web.sourceforge.net
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>
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>
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>
58 diff --git a/docs/news.html b/docs/news.html
59 index b3fb8b5..72d38ee 100644
66 +<h2>October 4, 2010</h2>
69 +<a href="relnotes-7.9.html">Mesa 7.9</a> (final) is released. This is a new
74 <h2>September 27, 2010</h2>
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.
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.
88 <h2>MD5 checksums</h2>
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
103 @@ -44,10 +52,95 @@ tbd
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
112 +<li>Assorted i965 driver fixes.
113 + Including but not limited to:
115 + <li>Fix scissoring when width or height is
116 + 0. <a href="https://bugs.freedesktop.org/show_bug.cgi?id=27643">Bug
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
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
129 + <li>Reject shaders with uninlined function calls instead of hanging.</li>
133 +<li>Assorted i915 driver fixes. Including but not limited to:
135 + <li>Fixed texture LOD clamping in i915 driver.
136 + <a href="https://bugs.freedesktop.org/show_bug.cgi?id=24846">Bug
138 + <li>Fix off-by-one for drawing rectangle.
139 + <a href="https://bugs.freedesktop.org/show_bug.cgi?id=27408">Bug
144 +<li>Fixed hangs in etracer on 830 and 845
145 + chipsets. <a href="https://bugs.freedesktop.org/show_bug.cgi?id=26557">Bug
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
152 +<li>Assorted GLX fixes. Including but not limited to:
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
167 +<li>Assorted GLSL fixes. Including but not limited to:
169 + <li>Change variable declared assertion into conditional in GLSL
170 + compiler. <a href="https://bugs.freedesktop.org/show_bug.cgi?id=27921">Bug
172 + <li>Fix instruction indexing
173 + bugs. <a href="https://bugs.freedesktop.org/show_bug.cgi?id=27566">Bug
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
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
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
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>
201 diff --git a/docs/relnotes-7.8.3.html b/docs/relnotes-7.8.3.html
203 index 0000000..1e9f433
205 +++ b/docs/relnotes-7.8.3.html
209 +<TITLE>Mesa Release Notes</TITLE>
211 +<head><link rel="stylesheet" type="text/css" href="mesa.css"></head>
215 +<body bgcolor="#eeeeee">
217 +<H1>Mesa 7.8.3 Release Notes / (date tbd)</H1>
220 +Mesa 7.8.3 is a bug fix release which fixes bugs found since the 7.8.2 release.
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.
228 +See the <a href="install.html">Compiling/Installing page</a> for prerequisites
229 +for DRI hardware acceleration.
233 +<h2>MD5 checksums</h2>
235 +x MesaLib-7.8.3.tar.gz
236 +x MesaLib-7.8.3.tar.bz2
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
247 +<h2>New features</h2>
253 +<li>The radeon driver should use less memory when searching for a valid mip
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
283 +<li>radeon/wine: flush command stream in more cases, fixing wine d3d9
285 +<li>r600: fix sin+cos normalization.</li>
286 +<li>r600: (properly) ignore <TT>GL_COORD_REPLACE</TT> when point sprites are
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>
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.
302 <h2>MD5 checksums</h2>
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
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.
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);
339 - api_mask = __DRI_API_OPENGL;
340 + api_mask = 1 << __DRI_API_OPENGL;
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");
352 - /* context stealing from another thread is not allowed */
353 - if (ctx->Binding && ctx->Binding != t)
354 - return _eglError(EGL_BAD_ACCESS, "eglMakeCurrent");
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
366 * "at most one context may be bound to a particular surface at a given
369 - * The latter is more restrictive so we can check only the latter case.
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");
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");
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
394 #include "egltypedefs.h"
400 * Define an inline driver typecast function.
401 diff --git a/src/gallium/drivers/llvmpipe/lp_bld_depth.c b/src/gallium/drivers/llvmpipe/lp_bld_depth.c
402 index 99a768a..749ae66 100644
403 --- a/src/gallium/drivers/llvmpipe/lp_bld_depth.c
404 +++ b/src/gallium/drivers/llvmpipe/lp_bld_depth.c
405 @@ -262,7 +262,7 @@ lp_build_stencil_op_single(struct lp_build_context *bld,
406 LLVMValueRef writemask = lp_build_const_int_vec(type, stencil->writemask);
407 mask = LLVMBuildAnd(bld->builder, mask, writemask, "");
408 /* res = (res & mask) | (stencilVals & ~mask) */
409 - res = lp_build_select_bitwise(bld, writemask, res, stencilVals);
410 + res = lp_build_select_bitwise(bld, mask, res, stencilVals);
413 /* res = mask ? res : stencilVals */
414 diff --git a/src/gallium/drivers/r300/r300_chipset.c b/src/gallium/drivers/r300/r300_chipset.c
415 index 48c2409..583e981 100644
416 --- a/src/gallium/drivers/r300/r300_chipset.c
417 +++ b/src/gallium/drivers/r300/r300_chipset.c
418 @@ -424,4 +424,5 @@ void r300_parse_chipset(struct r300_capabilities* caps)
421 caps->is_rv350 = caps->family >= CHIP_FAMILY_RV350;
422 + caps->dxtc_swizzle = caps->is_r400 || caps->is_r500;
424 diff --git a/src/gallium/drivers/r300/r300_chipset.h b/src/gallium/drivers/r300/r300_chipset.h
425 index e7ca642..7ea4175 100644
426 --- a/src/gallium/drivers/r300/r300_chipset.h
427 +++ b/src/gallium/drivers/r300/r300_chipset.h
428 @@ -79,6 +79,8 @@ struct r300_capabilities {
430 /* Whether or not the second pixel pipe is accessed with the high bit */
431 boolean high_second_pipe;
432 + /* DXTC texture swizzling. */
433 + boolean dxtc_swizzle;
436 /* Enumerations for legibility and telling which card we're running on. */
437 diff --git a/src/gallium/drivers/r300/r300_context.c b/src/gallium/drivers/r300/r300_context.c
438 index 624dadd..46504f5 100644
439 --- a/src/gallium/drivers/r300/r300_context.c
440 +++ b/src/gallium/drivers/r300/r300_context.c
441 @@ -79,6 +79,9 @@ static void r300_release_referenced_objects(struct r300_context *r300)
445 + /* The dummy VBO. */
446 + pipe_resource_reference(&r300->dummy_vb, NULL);
449 pipe_resource_reference(&r300->vbo, NULL);
451 @@ -488,6 +491,7 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen,
452 rtempl.target = PIPE_TEXTURE_2D;
453 rtempl.format = PIPE_FORMAT_I8_UNORM;
454 rtempl.bind = PIPE_BIND_SAMPLER_VIEW;
455 + rtempl.usage = PIPE_USAGE_IMMUTABLE;
459 @@ -501,6 +505,19 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen,
460 pipe_resource_reference(&tex, NULL);
464 + struct pipe_resource vb = {};
465 + vb.target = PIPE_BUFFER;
466 + vb.format = PIPE_FORMAT_R8_UNORM;
467 + vb.bind = PIPE_BIND_VERTEX_BUFFER;
468 + vb.usage = PIPE_USAGE_IMMUTABLE;
469 + vb.width0 = sizeof(float) * 16;
473 + r300->dummy_vb = screen->resource_create(screen, &vb);
476 return &r300->context;
479 diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h
480 index 8f4e2de..743e9da 100644
481 --- a/src/gallium/drivers/r300/r300_context.h
482 +++ b/src/gallium/drivers/r300/r300_context.h
483 @@ -470,6 +470,10 @@ struct r300_context {
484 * dummy texture there. */
485 struct r300_sampler_view *texkill_sampler;
487 + /* When no vertex buffer is set, this one is used instead to prevent
489 + struct pipe_resource *dummy_vb;
491 /* The currently active query. */
492 struct r300_query *query_current;
493 /* The saved query for blitter operations. */
494 diff --git a/src/gallium/drivers/r300/r300_reg.h b/src/gallium/drivers/r300/r300_reg.h
495 index 6bea783..788c513 100644
496 --- a/src/gallium/drivers/r300/r300_reg.h
497 +++ b/src/gallium/drivers/r300/r300_reg.h
498 @@ -1520,11 +1520,11 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
499 # define R300_TX_TRI_PERF_3_8 (3<<15)
500 # define R300_ANISO_THRESHOLD_MASK (7<<17)
502 +# define R400_DXTC_SWIZZLE_ENABLE (1<<21)
503 # define R500_MACRO_SWITCH (1<<22)
504 # define R500_TX_MAX_ANISO(x) ((x) << 23)
505 # define R500_TX_MAX_ANISO_MASK (63 << 23)
506 # define R500_TX_ANISO_HIGH_QUALITY (1 << 30)
508 # define R500_BORDER_FIX (1<<31)
510 #define R300_TX_FORMAT0_0 0x4480
511 diff --git a/src/gallium/drivers/r300/r300_render.c b/src/gallium/drivers/r300/r300_render.c
512 index 2f00c87..7a3eb09 100644
513 --- a/src/gallium/drivers/r300/r300_render.c
514 +++ b/src/gallium/drivers/r300/r300_render.c
515 @@ -676,9 +676,6 @@ static void r300_draw_vbo(struct pipe_context* pipe,
517 struct r300_context* r300 = r300_context(pipe);
519 - if (!r300->velems->count || !r300->vertex_buffer_count)
522 if (info->indexed && r300->index_buffer.buffer) {
525 diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c
526 index 7f41ff0..c349e7f 100644
527 --- a/src/gallium/drivers/r300/r300_screen.c
528 +++ b/src/gallium/drivers/r300/r300_screen.c
529 @@ -114,8 +114,9 @@ static int r300_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
530 case PIPE_CAP_TEXTURE_MIRROR_CLAMP:
531 case PIPE_CAP_TEXTURE_MIRROR_REPEAT:
532 case PIPE_CAP_BLEND_EQUATION_SEPARATE:
533 - case PIPE_CAP_TEXTURE_SWIZZLE:
535 + case PIPE_CAP_TEXTURE_SWIZZLE:
536 + return util_format_s3tc_enabled ? r300screen->caps.dxtc_swizzle : 1;
538 /* Unsupported features (boolean caps). */
539 case PIPE_CAP_TIMER_QUERY:
540 diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c
541 index 53c1657..7779766 100644
542 --- a/src/gallium/drivers/r300/r300_state.c
543 +++ b/src/gallium/drivers/r300/r300_state.c
544 @@ -1363,6 +1363,7 @@ r300_create_sampler_view(struct pipe_context *pipe,
545 struct r300_sampler_view *view = CALLOC_STRUCT(r300_sampler_view);
546 struct r300_texture *tex = r300_texture(texture);
547 boolean is_r500 = r300_screen(pipe->screen)->caps.is_r500;
548 + boolean dxtc_swizzle = r300_screen(pipe->screen)->caps.dxtc_swizzle;
552 @@ -1379,7 +1380,8 @@ r300_create_sampler_view(struct pipe_context *pipe,
553 view->format = tex->tx_format;
554 view->format.format1 |= r300_translate_texformat(templ->format,
560 view->format.format2 |= r500_tx_format_msb_bit(templ->format);
562 @@ -1464,6 +1466,15 @@ static void r300_set_vertex_buffers(struct pipe_context* pipe,
563 struct pipe_vertex_buffer *vbo;
564 unsigned i, max_index = (1 << 24) - 1;
565 boolean any_user_buffer = FALSE;
566 + struct pipe_vertex_buffer dummy_vb = {0};
568 + /* There must be at least one vertex buffer set, otherwise it locks up. */
570 + dummy_vb.buffer = r300->dummy_vb;
571 + dummy_vb.max_index = r300->dummy_vb->width0 / 4;
572 + buffers = &dummy_vb;
576 if (count == r300->vertex_buffer_count &&
577 memcmp(r300->vertex_buffer, buffers,
578 @@ -1617,6 +1628,14 @@ static void* r300_create_vertex_elements_state(struct pipe_context* pipe,
579 struct r300_vertex_element_state *velems;
581 enum pipe_format *format;
582 + struct pipe_vertex_element dummy_attrib = {0};
584 + /* R300 Programmable Stream Control (PSC) doesn't support 0 vertex elements. */
586 + dummy_attrib.src_format = PIPE_FORMAT_R8G8B8A8_UNORM;
587 + attribs = &dummy_attrib;
591 assert(count <= PIPE_MAX_ATTRIBS);
592 velems = CALLOC_STRUCT(r300_vertex_element_state);
593 @@ -1683,7 +1702,8 @@ static void* r300_create_vertex_elements_state(struct pipe_context* pipe,
594 * swizzles are already set up.
595 * Also compute the vertex size. */
596 for (i = 0; i < count; i++) {
597 - /* This is OK because we check for aligned strides too. */
598 + /* This is OK because we check for aligned strides too
600 velems->hw_format_size[i] =
601 align(util_format_get_blocksize(velems->hw_format[i]), 4);
602 velems->vertex_size_dwords += velems->hw_format_size[i] / 4;
603 diff --git a/src/gallium/drivers/r300/r300_state_derived.c b/src/gallium/drivers/r300/r300_state_derived.c
604 index 2613e70..9d8b6da 100644
605 --- a/src/gallium/drivers/r300/r300_state_derived.c
606 +++ b/src/gallium/drivers/r300/r300_state_derived.c
609 #include "util/u_math.h"
610 #include "util/u_memory.h"
611 +#include "util/u_pack_color.h"
613 #include "r300_context.h"
615 @@ -568,55 +569,93 @@ static void r300_update_rs_block(struct r300_context *r300)
618 static uint32_t r300_get_border_color(enum pipe_format format,
619 - const float border[4])
620 + const float border[4],
623 const struct util_format_description *desc;
624 - float border_swizzled[4] = {
631 + float border_swizzled[4] = {0};
633 + union util_color uc = {0};
635 desc = util_format_description(format);
637 - /* We don't use util_pack_format because it does not handle the formats
638 - * we want, e.g. R4G4B4A4 is non-existent in Gallium. */
639 + /* Do depth formats first. */
640 + if (util_format_is_depth_or_stencil(format)) {
642 + case PIPE_FORMAT_Z16_UNORM:
643 + return util_pack_z(PIPE_FORMAT_Z16_UNORM, border[0]);
644 + case PIPE_FORMAT_X8Z24_UNORM:
645 + case PIPE_FORMAT_S8_USCALED_Z24_UNORM:
647 + return util_pack_z(PIPE_FORMAT_X8Z24_UNORM, border[0]);
649 + return util_pack_z(PIPE_FORMAT_Z16_UNORM, border[0]) << 16;
657 + /* Apply inverse swizzle of the format. */
658 + for (i = 0; i < 4; i++) {
659 + switch (desc->swizzle[i]) {
660 + case UTIL_FORMAT_SWIZZLE_X:
661 + border_swizzled[2] = border[i];
663 + case UTIL_FORMAT_SWIZZLE_Y:
664 + border_swizzled[1] = border[i];
666 + case UTIL_FORMAT_SWIZZLE_Z:
667 + border_swizzled[0] = border[i];
669 + case UTIL_FORMAT_SWIZZLE_W:
670 + border_swizzled[3] = border[i];
675 + /* Compressed formats. */
676 + if (util_format_is_compressed(format)) {
677 + util_pack_color(border_swizzled, PIPE_FORMAT_R8G8B8A8_UNORM, &uc);
681 switch (desc->channel[0].size) {
683 - r = ((float_to_ubyte(border_swizzled[0]) & 0xf0) >> 4) |
684 - ((float_to_ubyte(border_swizzled[1]) & 0xf0) << 0) |
685 - ((float_to_ubyte(border_swizzled[2]) & 0xf0) << 4) |
686 - ((float_to_ubyte(border_swizzled[3]) & 0xf0) << 8);
687 + util_pack_color(border_swizzled, PIPE_FORMAT_B4G4R4A4_UNORM, &uc);
691 if (desc->channel[1].size == 5) {
692 - r = ((float_to_ubyte(border_swizzled[0]) & 0xf8) >> 3) |
693 - ((float_to_ubyte(border_swizzled[1]) & 0xf8) << 2) |
694 - ((float_to_ubyte(border_swizzled[2]) & 0xf8) << 7) |
695 - ((float_to_ubyte(border_swizzled[3]) & 0x80) << 8);
696 + util_pack_color(border_swizzled, PIPE_FORMAT_B5G5R5A1_UNORM, &uc);
697 } else if (desc->channel[1].size == 6) {
698 - r = ((float_to_ubyte(border_swizzled[0]) & 0xf8) >> 3) |
699 - ((float_to_ubyte(border_swizzled[1]) & 0xfc) << 3) |
700 - ((float_to_ubyte(border_swizzled[2]) & 0xf8) << 8);
701 + util_pack_color(border_swizzled, PIPE_FORMAT_B5G6R5_UNORM, &uc);
708 - /* I think the fat formats (16, 32) are specified
709 - * as the 8-bit ones. I am not sure how compressed formats
711 - r = ((float_to_ubyte(border_swizzled[0]) & 0xff) << 0) |
712 - ((float_to_ubyte(border_swizzled[1]) & 0xff) << 8) |
713 - ((float_to_ubyte(border_swizzled[2]) & 0xff) << 16) |
714 - ((float_to_ubyte(border_swizzled[3]) & 0xff) << 24);
716 + util_pack_color(border_swizzled, PIPE_FORMAT_B8G8R8A8_UNORM, &uc);
720 + util_pack_color(border_swizzled, PIPE_FORMAT_B10G10R10A2_UNORM, &uc);
724 + if (desc->nr_channels <= 2) {
725 + border_swizzled[0] = border_swizzled[2];
726 + util_pack_color(border_swizzled, PIPE_FORMAT_R16G16_UNORM, &uc);
728 + util_pack_color(border_swizzled, PIPE_FORMAT_B8G8R8A8_UNORM, &uc);
737 static void r300_merge_textures_and_samplers(struct r300_context* r300)
738 @@ -655,7 +694,8 @@ static void r300_merge_textures_and_samplers(struct r300_context* r300)
739 /* Set the border color. */
740 texstate->border_color =
741 r300_get_border_color(view->base.format,
742 - sampler->state.border_color);
743 + sampler->state.border_color,
744 + r300->screen->caps.is_r500);
746 /* determine min/max levels */
747 max_level = MIN3(sampler->max_lod + view->base.first_level,
748 @@ -701,13 +741,18 @@ static void r300_merge_textures_and_samplers(struct r300_context* r300)
749 if (sampler->state.compare_mode == PIPE_TEX_COMPARE_NONE) {
750 texstate->format.format1 |=
751 r300_get_swizzle_combined(depth_swizzle,
753 + view->swizzle, FALSE);
755 texstate->format.format1 |=
756 - r300_get_swizzle_combined(depth_swizzle, 0);
757 + r300_get_swizzle_combined(depth_swizzle, 0, FALSE);
761 + if (r300->screen->caps.dxtc_swizzle &&
762 + util_format_is_compressed(tex->desc.b.b.format)) {
763 + texstate->filter1 |= R400_DXTC_SWIZZLE_ENABLE;
766 /* to emulate 1D textures through 2D ones correctly */
767 if (tex->desc.b.b.target == PIPE_TEXTURE_1D) {
768 texstate->filter0 &= ~R300_TX_WRAP_T_MASK;
769 diff --git a/src/gallium/drivers/r300/r300_texture.c b/src/gallium/drivers/r300/r300_texture.c
770 index 34105aa..7e2f69a 100644
771 --- a/src/gallium/drivers/r300/r300_texture.c
772 +++ b/src/gallium/drivers/r300/r300_texture.c
774 #include "pipe/p_screen.h"
776 unsigned r300_get_swizzle_combined(const unsigned char *swizzle_format,
777 - const unsigned char *swizzle_view)
778 + const unsigned char *swizzle_view,
779 + boolean dxtc_swizzle)
782 unsigned char swizzle[4];
783 @@ -51,10 +52,10 @@ unsigned r300_get_swizzle_combined(const unsigned char *swizzle_format,
784 R300_TX_FORMAT_B_SHIFT,
785 R300_TX_FORMAT_A_SHIFT
787 - const uint32_t swizzle_bit[4] = {
789 + uint32_t swizzle_bit[4] = {
790 + dxtc_swizzle ? R300_TX_FORMAT_Z : R300_TX_FORMAT_X,
793 + dxtc_swizzle ? R300_TX_FORMAT_X : R300_TX_FORMAT_Z,
797 @@ -107,7 +108,8 @@ unsigned r300_get_swizzle_combined(const unsigned char *swizzle_format,
798 * makes available X, Y, Z, W, ZERO, and ONE for swizzling. */
799 uint32_t r300_translate_texformat(enum pipe_format format,
800 const unsigned char *swizzle_view,
803 + boolean dxtc_swizzle)
806 const struct util_format_description *desc;
807 @@ -169,7 +171,8 @@ uint32_t r300_translate_texformat(enum pipe_format format,
811 - result |= r300_get_swizzle_combined(desc->swizzle, swizzle_view);
812 + result |= r300_get_swizzle_combined(desc->swizzle, swizzle_view,
813 + util_format_is_compressed(format) && dxtc_swizzle);
816 if (desc->layout == UTIL_FORMAT_LAYOUT_S3TC) {
817 @@ -538,7 +541,7 @@ boolean r300_is_zs_format_supported(enum pipe_format format)
819 boolean r300_is_sampler_format_supported(enum pipe_format format)
821 - return r300_translate_texformat(format, 0, TRUE) != ~0;
822 + return r300_translate_texformat(format, 0, TRUE, FALSE) != ~0;
825 void r300_texture_setup_format_state(struct r300_screen *screen,
826 diff --git a/src/gallium/drivers/r300/r300_texture.h b/src/gallium/drivers/r300/r300_texture.h
827 index c4588a0..fe9d351 100644
828 --- a/src/gallium/drivers/r300/r300_texture.h
829 +++ b/src/gallium/drivers/r300/r300_texture.h
830 @@ -35,11 +35,13 @@ struct r300_texture;
833 unsigned r300_get_swizzle_combined(const unsigned char *swizzle_format,
834 - const unsigned char *swizzle_view);
835 + const unsigned char *swizzle_view,
836 + boolean dxtc_swizzle);
838 uint32_t r300_translate_texformat(enum pipe_format format,
839 const unsigned char *swizzle_view,
842 + boolean dxtc_swizzle);
844 uint32_t r500_tx_format_msb_bit(enum pipe_format format);
846 diff --git a/src/gallium/drivers/r300/r300_texture_desc.c b/src/gallium/drivers/r300/r300_texture_desc.c
847 index e2d01cd..ff6d2b2 100644
848 --- a/src/gallium/drivers/r300/r300_texture_desc.c
849 +++ b/src/gallium/drivers/r300/r300_texture_desc.c
850 @@ -44,7 +44,7 @@ unsigned r300_get_pixel_alignment(enum pipe_format format,
851 {{ 32, 1}, { 8, 4}, { 0, 0}}, /* 8 bits per pixel */
852 {{ 16, 1}, { 8, 2}, { 4, 4}}, /* 16 bits per pixel */
853 {{ 8, 1}, { 4, 2}, { 0, 0}}, /* 32 bits per pixel */
854 - {{ 4, 1}, { 0, 0}, { 2, 2}}, /* 64 bits per pixel */
855 + {{ 4, 1}, { 2, 2}, { 0, 0}}, /* 64 bits per pixel */
856 {{ 2, 1}, { 0, 0}, { 0, 0}} /* 128 bits per pixel */
859 @@ -53,7 +53,7 @@ unsigned r300_get_pixel_alignment(enum pipe_format format,
860 {{256, 8}, {64, 32}, { 0, 0}}, /* 8 bits per pixel */
861 {{128, 8}, {64, 16}, {32, 32}}, /* 16 bits per pixel */
862 {{ 64, 8}, {32, 16}, { 0, 0}}, /* 32 bits per pixel */
863 - {{ 32, 8}, { 0, 0}, {16, 16}}, /* 64 bits per pixel */
864 + {{ 32, 8}, {16, 16}, { 0, 0}}, /* 64 bits per pixel */
865 {{ 16, 8}, { 0, 0}, { 0, 0}} /* 128 bits per pixel */
868 @@ -368,11 +368,11 @@ static void r300_setup_tiling(struct r300_screen *screen,
869 switch (util_format_get_blocksize(format)) {
873 desc->microtile = R300_BUFFER_TILED;
878 if (rws->get_value(rws, R300_VID_SQUARE_TILING_SUPPORT)) {
879 desc->microtile = R300_BUFFER_SQUARETILED;
881 diff --git a/src/gallium/state_trackers/egl/Makefile b/src/gallium/state_trackers/egl/Makefile
882 index 8dbfc5b..8cfcef9 100644
883 --- a/src/gallium/state_trackers/egl/Makefile
884 +++ b/src/gallium/state_trackers/egl/Makefile
885 @@ -17,7 +17,7 @@ x11_INCLUDES = \
889 - $(shell pkg-config --cflags-only-I libdrm)
890 + $(shell pkg-config --cflags-only-I libdrm dri2proto)
892 x11_SOURCES = $(wildcard x11/*.c) \
893 $(TOP)/src/glx/dri2.c
894 diff --git a/src/gallium/state_trackers/egl/common/egl_g3d_api.c b/src/gallium/state_trackers/egl/common/egl_g3d_api.c
895 index c0164da..3bde397 100644
896 --- a/src/gallium/state_trackers/egl/common/egl_g3d_api.c
897 +++ b/src/gallium/state_trackers/egl/common/egl_g3d_api.c
898 @@ -609,8 +609,10 @@ egl_g3d_wait_client(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *ctx)
900 gctx->stctxi->flush(gctx->stctxi,
901 PIPE_FLUSH_RENDER_CACHE | PIPE_FLUSH_FRAME, &fence);
902 - screen->fence_finish(screen, fence, 0);
903 - screen->fence_reference(screen, &fence, NULL);
905 + screen->fence_finish(screen, fence, 0);
906 + screen->fence_reference(screen, &fence, NULL);
911 diff --git a/src/gallium/state_trackers/egl/x11/native_x11.h b/src/gallium/state_trackers/egl/x11/native_x11.h
912 index 0b47837..8945117 100644
913 --- a/src/gallium/state_trackers/egl/x11/native_x11.h
914 +++ b/src/gallium/state_trackers/egl/x11/native_x11.h
916 #define _NATIVE_X11_H_
918 #include "common/native.h"
919 +#include <X11/Xlib.h>
921 struct native_display *
922 x11_create_ximage_display(Display *dpy,
923 diff --git a/src/gallium/state_trackers/vega/api_context.c b/src/gallium/state_trackers/vega/api_context.c
924 index 0d04d8e..d6bbda5 100644
925 --- a/src/gallium/state_trackers/vega/api_context.c
926 +++ b/src/gallium/state_trackers/vega/api_context.c
927 @@ -73,7 +73,8 @@ void vegaFinish(void)
930 pipe->flush(pipe, PIPE_FLUSH_RENDER_CACHE | PIPE_FLUSH_FRAME, &fence);
932 - pipe->screen->fence_finish(pipe->screen, fence, 0);
933 - pipe->screen->fence_reference(pipe->screen, &fence, NULL);
935 + pipe->screen->fence_finish(pipe->screen, fence, 0);
936 + pipe->screen->fence_reference(pipe->screen, &fence, NULL);
939 diff --git a/src/gallium/state_trackers/vega/vg_manager.c b/src/gallium/state_trackers/vega/vg_manager.c
940 index e799674..232deef 100644
941 --- a/src/gallium/state_trackers/vega/vg_manager.c
942 +++ b/src/gallium/state_trackers/vega/vg_manager.c
943 @@ -352,7 +352,7 @@ vg_api_create_context(struct st_api *stapi, struct st_manager *smapi,
946 /* only 1.0 is supported */
947 - if (attribs->major != 1 || attribs->minor > 0)
948 + if (attribs->major > 1 || (attribs->major == 1 && attribs->minor > 0))
951 pipe = smapi->screen->context_create(smapi->screen, NULL);
952 diff --git a/src/gallium/state_trackers/xorg/Makefile b/src/gallium/state_trackers/xorg/Makefile
953 index cb2c3ae..7a44d28 100644
954 --- a/src/gallium/state_trackers/xorg/Makefile
955 +++ b/src/gallium/state_trackers/xorg/Makefile
956 @@ -10,7 +10,7 @@ LIBRARY_INCLUDES = \
957 $(shell pkg-config libkms --atleast-version=1.0 \
958 && echo "-DHAVE_LIBKMS") \
959 $(shell pkg-config libkms --silence-errors --cflags-only-I) \
960 - $(shell pkg-config --cflags-only-I pixman-1 xorg-server libdrm xproto) \
961 + $(shell pkg-config --cflags-only-I pixman-1 xorg-server libdrm xproto dri2proto) \
962 -I$(TOP)/src/gallium/include \
963 -I$(TOP)/src/gallium/auxiliary \
965 diff --git a/src/gallium/state_trackers/xorg/xorg_crtc.c b/src/gallium/state_trackers/xorg/xorg_crtc.c
966 index 26a907f..80af82d 100644
967 --- a/src/gallium/state_trackers/xorg/xorg_crtc.c
968 +++ b/src/gallium/state_trackers/xorg/xorg_crtc.c
969 @@ -234,6 +234,10 @@ crtc_load_cursor_argb_ga3d(xf86CrtcPtr crtc, CARD32 * image)
970 64, 64, (void*)image, 64 * 4, 0, 0);
971 ms->ctx->transfer_unmap(ms->ctx, transfer);
972 ms->ctx->transfer_destroy(ms->ctx, transfer);
974 + if (crtc->cursor_shown)
975 + drmModeSetCursor(ms->fd, crtcp->drm_crtc->crtc_id,
976 + crtcp->cursor_handle, 64, 64);
980 @@ -271,6 +275,10 @@ crtc_load_cursor_argb_kms(xf86CrtcPtr crtc, CARD32 * image)
981 memcpy(ptr, image, 64*64*4);
982 kms_bo_unmap(crtcp->cursor_bo);
984 + if (crtc->cursor_shown)
985 + drmModeSetCursor(ms->fd, crtcp->drm_crtc->crtc_id,
986 + crtcp->cursor_handle, 64, 64);
991 @@ -353,7 +361,7 @@ crtc_destroy(xf86CrtcPtr crtc)
993 drmModeFreeCrtc(crtcp->drm_crtc);
997 crtc->driver_private = NULL;
1000 @@ -401,7 +409,7 @@ xorg_crtc_init(ScrnInfoPtr pScrn)
1004 - crtcp = xcalloc(1, sizeof(struct crtc_private));
1005 + crtcp = calloc(1, sizeof(struct crtc_private));
1007 xf86CrtcDestroy(crtc);
1009 diff --git a/src/gallium/state_trackers/xorg/xorg_dri2.c b/src/gallium/state_trackers/xorg/xorg_dri2.c
1010 index 704aed6..b723a8e 100644
1011 --- a/src/gallium/state_trackers/xorg/xorg_dri2.c
1012 +++ b/src/gallium/state_trackers/xorg/xorg_dri2.c
1013 @@ -201,11 +201,11 @@ dri2_create_buffer(DrawablePtr pDraw, unsigned int attachment, unsigned int form
1014 DRI2Buffer2Ptr buffer;
1015 BufferPrivatePtr private;
1017 - buffer = xcalloc(1, sizeof *buffer);
1018 + buffer = calloc(1, sizeof *buffer);
1022 - private = xcalloc(1, sizeof *private);
1023 + private = calloc(1, sizeof *private);
1027 @@ -217,9 +217,9 @@ dri2_create_buffer(DrawablePtr pDraw, unsigned int attachment, unsigned int form
1028 if (dri2_do_create_buffer(pDraw, (DRI2BufferPtr)buffer, format))
1039 @@ -229,8 +229,8 @@ dri2_destroy_buffer(DrawablePtr pDraw, DRI2Buffer2Ptr buffer)
1040 /* So far it is safe to downcast a DRI2Buffer2Ptr to DRI2BufferPtr */
1041 dri2_do_destroy_buffer(pDraw, (DRI2BufferPtr)buffer);
1043 - xfree(buffer->driverPrivate);
1045 + free(buffer->driverPrivate);
1049 #endif /* DRI2INFOREC_VERSION >= 2 */
1050 @@ -244,11 +244,11 @@ dri2_create_buffers(DrawablePtr pDraw, unsigned int *attachments, int count)
1051 DRI2BufferPtr buffers;
1054 - buffers = xcalloc(count, sizeof *buffers);
1055 + buffers = calloc(count, sizeof *buffers);
1059 - privates = xcalloc(count, sizeof *privates);
1060 + privates = calloc(count, sizeof *privates);
1064 @@ -263,9 +263,9 @@ dri2_create_buffers(DrawablePtr pDraw, unsigned int *attachments, int count)
1076 @@ -280,8 +280,8 @@ dri2_destroy_buffers(DrawablePtr pDraw, DRI2BufferPtr buffers, int count)
1080 - xfree(buffers[0].driverPrivate);
1082 + free(buffers[0].driverPrivate);
1087 diff --git a/src/gallium/state_trackers/xorg/xorg_driver.c b/src/gallium/state_trackers/xorg/xorg_driver.c
1088 index e10ff2f..1ec772d 100644
1089 --- a/src/gallium/state_trackers/xorg/xorg_driver.c
1090 +++ b/src/gallium/state_trackers/xorg/xorg_driver.c
1092 #include "miscstruct.h"
1093 #include "dixstruct.h"
1095 +#include "xorgVersion.h"
1096 #ifndef XSERVER_LIBPCIACCESS
1097 #error "libpciaccess needed"
1099 @@ -122,7 +123,7 @@ xorg_tracker_set_functions(ScrnInfoPtr scrn)
1101 xorg_tracker_have_modesetting(ScrnInfoPtr pScrn, struct pci_device *device)
1103 - char *BusID = xalloc(64);
1104 + char *BusID = malloc(64);
1105 sprintf(BusID, "pci:%04x:%02x:%02x.%d",
1106 device->domain, device->bus,
1107 device->dev, device->func);
1108 @@ -130,14 +131,14 @@ xorg_tracker_have_modesetting(ScrnInfoPtr pScrn, struct pci_device *device)
1109 if (drmCheckModesettingSupported(BusID)) {
1110 xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 0,
1111 "Drm modesetting not supported %s\n", BusID);
1117 xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 0,
1118 "Drm modesetting supported on %s\n", BusID);
1125 @@ -174,7 +175,7 @@ drv_free_rec(ScrnInfoPtr pScrn)
1126 if (!pScrn->driverPrivate)
1129 - xfree(pScrn->driverPrivate);
1130 + free(pScrn->driverPrivate);
1132 pScrn->driverPrivate = NULL;
1134 @@ -274,7 +275,7 @@ drv_init_drm(ScrnInfoPtr pScrn)
1138 - BusID = xalloc(64);
1139 + BusID = malloc(64);
1140 sprintf(BusID, "PCI:%d:%d:%d",
1141 ((ms->PciInfo->domain << 8) | ms->PciInfo->bus),
1142 ms->PciInfo->dev, ms->PciInfo->func
1143 @@ -283,7 +284,7 @@ drv_init_drm(ScrnInfoPtr pScrn)
1145 ms->fd = drmOpen(driver_descriptor.driver_name, BusID);
1146 ms->isMaster = TRUE;
1152 @@ -369,6 +370,7 @@ drv_pre_init(ScrnInfoPtr pScrn, int flags)
1153 ms = modesettingPTR(pScrn);
1158 pScrn->displayWidth = 640; /* default it */
1160 @@ -402,19 +404,6 @@ drv_pre_init(ScrnInfoPtr pScrn, int flags)
1161 if (!drv_init_drm(pScrn))
1164 - use3D = cust ? !cust->no_3d : TRUE;
1165 - ms->from_3D = xf86GetOptValBool(ms->Options, OPTION_3D_ACCEL,
1167 - X_CONFIG : X_PROBED;
1169 - ms->no3D = !use3D;
1171 - if (!drv_init_resource_management(pScrn)) {
1172 - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Could not init "
1173 - "Gallium3D or libKMS.");
1177 pScrn->monitor = pScrn->confScreen->monitor;
1178 pScrn->progClock = TRUE;
1180 @@ -444,11 +433,24 @@ drv_pre_init(ScrnInfoPtr pScrn, int flags)
1182 /* Process the options */
1183 xf86CollectOptions(pScrn, NULL);
1184 - if (!(ms->Options = xalloc(sizeof(drv_options))))
1185 + if (!(ms->Options = malloc(sizeof(drv_options))))
1187 memcpy(ms->Options, drv_options, sizeof(drv_options));
1188 xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, ms->Options);
1190 + use3D = cust ? !cust->no_3d : TRUE;
1191 + ms->from_3D = xf86GetOptValBool(ms->Options, OPTION_3D_ACCEL,
1193 + X_CONFIG : X_PROBED;
1195 + ms->no3D = !use3D;
1197 + if (!drv_init_resource_management(pScrn)) {
1198 + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Could not init "
1199 + "Gallium3D or libKMS.");
1203 /* Allocate an xf86CrtcConfig */
1204 xf86CrtcConfigInit(pScrn, &crtc_config_funcs);
1205 xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
1206 @@ -791,7 +793,9 @@ drv_screen_init(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
1208 xf86_cursors_init(pScreen, 64, 64,
1209 HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_64 |
1210 - HARDWARE_CURSOR_ARGB);
1211 + HARDWARE_CURSOR_ARGB |
1212 + ((cust && cust->unhidden_hw_cursor_update) ?
1213 + HARDWARE_CURSOR_UPDATE_UNHIDDEN : 0));
1215 /* Must force it before EnterVT, so we are in control of VT and
1216 * later memory should be bound when allocating, e.g rotate_mem */
1217 @@ -862,8 +866,10 @@ drv_leave_vt(int scrnIndex, int flags)
1221 - drmModeRmFB(ms->fd, ms->fb_id);
1223 + if (ms->fb_id != -1) {
1224 + drmModeRmFB(ms->fd, ms->fb_id);
1230 @@ -944,7 +950,6 @@ drv_close_screen(int scrnIndex, ScreenPtr pScreen)
1234 - drmModeRmFB(ms->fd, ms->fb_id);
1235 ms->destroy_front_buffer(pScrn);
1238 @@ -1178,6 +1183,8 @@ drv_bind_front_buffer_kms(ScrnInfoPtr pScrn)
1242 +#if (XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(1, 9, 99, 1, 0))
1244 /* This a hack to work around EnableDisableFBAccess setting the pointer
1245 * the real fix would be to replace pScrn->EnableDisableFBAccess hook
1246 * and set the rootPixmap->devPrivate.ptr to something valid before that.
1247 @@ -1187,6 +1194,8 @@ drv_bind_front_buffer_kms(ScrnInfoPtr pScrn)
1249 pScrn->pixmapPrivate.ptr = ptr;
1256 diff --git a/src/gallium/state_trackers/xorg/xorg_exa.c b/src/gallium/state_trackers/xorg/xorg_exa.c
1257 index 6b2c80f..0e5693d 100644
1258 --- a/src/gallium/state_trackers/xorg/xorg_exa.c
1259 +++ b/src/gallium/state_trackers/xorg/xorg_exa.c
1260 @@ -720,7 +720,7 @@ ExaCreatePixmap(ScreenPtr pScreen, int size, int align)
1262 struct exa_pixmap_priv *priv;
1264 - priv = xcalloc(1, sizeof(struct exa_pixmap_priv));
1265 + priv = calloc(1, sizeof(struct exa_pixmap_priv));
1269 @@ -737,7 +737,7 @@ ExaDestroyPixmap(ScreenPtr pScreen, void *dPriv)
1271 pipe_resource_reference(&priv->tex, NULL);
1278 @@ -975,7 +975,7 @@ xorg_exa_close(ScrnInfoPtr pScrn)
1281 exaDriverFini(pScrn->pScreen);
1287 @@ -987,7 +987,7 @@ xorg_exa_init(ScrnInfoPtr pScrn, Bool accel)
1289 CustomizerPtr cust = ms->cust;
1291 - exa = xcalloc(1, sizeof(struct exa_context));
1292 + exa = calloc(1, sizeof(struct exa_context));
1296 diff --git a/src/gallium/state_trackers/xorg/xorg_output.c b/src/gallium/state_trackers/xorg/xorg_output.c
1297 index 61206ed..5555b51 100644
1298 --- a/src/gallium/state_trackers/xorg/xorg_output.c
1299 +++ b/src/gallium/state_trackers/xorg/xorg_output.c
1300 @@ -128,7 +128,7 @@ output_get_modes(xf86OutputPtr output)
1301 for (i = 0; i < drm_connector->count_modes; i++) {
1302 drm_mode = &drm_connector->modes[i];
1304 - mode = xcalloc(1, sizeof(DisplayModeRec));
1305 + mode = calloc(1, sizeof(DisplayModeRec));
1308 mode->Clock = drm_mode->clock;
1309 @@ -195,7 +195,7 @@ output_destroy(xf86OutputPtr output)
1311 struct output_private *priv = output->driver_private;
1312 drmModeFreeConnector(priv->drm_connector);
1315 output->driver_private = NULL;
1318 @@ -262,14 +262,14 @@ xorg_output_init(ScrnInfoPtr pScrn)
1319 drm_connector->connector_type_id);
1322 - priv = xcalloc(sizeof(*priv), 1);
1323 + priv = calloc(sizeof(*priv), 1);
1328 output = xf86OutputCreate(pScrn, &output_funcs, name);
1335 diff --git a/src/gallium/state_trackers/xorg/xorg_tracker.h b/src/gallium/state_trackers/xorg/xorg_tracker.h
1336 index be1a9fd..a3fb5e5 100644
1337 --- a/src/gallium/state_trackers/xorg/xorg_tracker.h
1338 +++ b/src/gallium/state_trackers/xorg/xorg_tracker.h
1339 @@ -76,6 +76,7 @@ typedef struct _CustomizerRec
1340 Bool dirty_throttling;
1341 Bool swap_throttling;
1343 + Bool unhidden_hw_cursor_update;
1344 Bool (*winsys_pre_init) (struct _CustomizerRec *cust, int fd);
1345 Bool (*winsys_screen_init)(struct _CustomizerRec *cust);
1346 Bool (*winsys_screen_close)(struct _CustomizerRec *cust);
1347 diff --git a/src/gallium/state_trackers/xorg/xorg_xv.c b/src/gallium/state_trackers/xorg/xorg_xv.c
1348 index f98bd93..f64959f 100644
1349 --- a/src/gallium/state_trackers/xorg/xorg_xv.c
1350 +++ b/src/gallium/state_trackers/xorg/xorg_xv.c
1351 @@ -536,8 +536,10 @@ display_video(ScrnInfoPtr pScrn, struct xorg_xv_port_priv *pPriv, int id,
1352 dst_surf = xorg_gpu_surface(pPriv->r->pipe->screen, dst);
1353 hdtv = ((src_w >= RES_720P_X) && (src_h >= RES_720P_Y));
1356 REGION_TRANSLATE(pScrn->pScreen, dstRegion, -pPixmap->screen_x,
1357 -pPixmap->screen_y);
1360 dxo = dstRegion->extents.x1;
1361 dyo = dstRegion->extents.y1;
1362 @@ -562,11 +564,16 @@ display_video(ScrnInfoPtr pScrn, struct xorg_xv_port_priv *pPriv, int id,
1363 int box_y2 = pbox->y2;
1364 float diff_x = (float)src_w / (float)dst_w;
1365 float diff_y = (float)src_h / (float)dst_h;
1366 - float offset_x = box_x1 - dstX + pPixmap->screen_x;
1367 - float offset_y = box_y1 - dstY + pPixmap->screen_y;
1368 + float offset_x = box_x1 - dstX;
1369 + float offset_y = box_y1 - dstY;
1374 + offset_x += pPixmap->screen_x;
1375 + offset_y += pPixmap->screen_y;
1380 w = box_x2 - box_x1;
1381 diff --git a/src/gallium/targets/Makefile.dri b/src/gallium/targets/Makefile.dri
1382 index 59961e9..3fb4cc6 100644
1383 --- a/src/gallium/targets/Makefile.dri
1384 +++ b/src/gallium/targets/Makefile.dri
1385 @@ -80,7 +80,7 @@ $(LIBNAME): $(OBJECTS) $(MESA_MODULES) $(PIPE_DRIVERS) Makefile \
1386 $(OBJECTS) $(PIPE_DRIVERS) \
1387 -Wl,--start-group $(MESA_MODULES) -Wl,--end-group \
1388 $(DRI_LIB_DEPS) $(DRIVER_EXTRAS)
1389 - $(CXX) $(CFLAGS) -o $@.test $(TOP)/src/mesa/drivers/dri/common/dri_test.o $@.tmp $(DRI_LIB_DEPS);
1390 + $(CXX) $(CFLAGS) -o $@.test $(TOP)/src/mesa/drivers/dri/common/dri_test.o $@.tmp $(DRI_LIB_DEPS) $(LDFLAGS);
1394 diff --git a/src/gallium/targets/Makefile.xorg b/src/gallium/targets/Makefile.xorg
1395 index 762c905..87eedd7 100644
1396 --- a/src/gallium/targets/Makefile.xorg
1397 +++ b/src/gallium/targets/Makefile.xorg
1398 @@ -29,7 +29,7 @@ INCLUDES = \
1399 LIBNAME_STAGING = $(TOP)/$(LIB_DIR)/gallium/$(TARGET)
1401 ifeq ($(MESA_LLVM),1)
1404 LDFLAGS += $(LLVM_LDFLAGS)
1406 DRIVER_PIPES += $(TOP)/src/gallium/drivers/llvmpipe/libllvmpipe.a
1407 @@ -42,7 +42,7 @@ endif
1408 default: depend $(TOP)/$(LIB_DIR)/gallium $(LIBNAME) $(LIBNAME_STAGING)
1410 $(LIBNAME): $(OBJECTS) Makefile ../Makefile.xorg $(LIBS) $(DRIVER_PIPES)
1411 - $(MKLIB) -noprefix -o $@ $(LDFLAGS) $(OBJECTS) $(DRIVER_PIPES) $(GALLIUM_AUXILIARIES) $(DRIVER_LINKS)
1412 + $(MKLIB) -linker $(CC) -noprefix -o $@ $(LDFLAGS) $(OBJECTS) $(DRIVER_PIPES) $(GALLIUM_AUXILIARIES) $(DRIVER_LINKS)
1414 depend: $(C_SOURCES) $(CPP_SOURCES) $(ASM_SOURCES) $(SYMLINKS) $(GENERATED_SOURCES)
1416 diff --git a/src/gallium/targets/dri-vmwgfx/Makefile b/src/gallium/targets/dri-vmwgfx/Makefile
1417 index 97c703b..38f7893 100644
1418 --- a/src/gallium/targets/dri-vmwgfx/Makefile
1419 +++ b/src/gallium/targets/dri-vmwgfx/Makefile
1420 @@ -12,6 +12,7 @@ PIPE_DRIVERS = \
1425 $(COMMON_GALLIUM_SOURCES)
1428 diff --git a/src/gallium/targets/dri-vmwgfx/vmw_powf.c b/src/gallium/targets/dri-vmwgfx/vmw_powf.c
1429 new file mode 100644
1430 index 0000000..ca5e39b
1432 +++ b/src/gallium/targets/dri-vmwgfx/vmw_powf.c
1435 + * Powf may leave an unresolved symbol pointing to a libstdc++.so powf.
1436 + * However, not all libstdc++.so include this function, so optionally
1437 + * replace the powf function with calls to expf and logf.
1440 +#ifdef VMW_RESOLVE_POWF
1442 +extern float expf(float x);
1443 +extern float logf(float x);
1444 +extern float powf(float x, float y);
1446 +float powf(float x, float y) {
1447 + return expf(logf(x)*y);
1451 diff --git a/src/gallium/targets/egl/Makefile b/src/gallium/targets/egl/Makefile
1452 index 47c24ce..38e60db 100644
1453 --- a/src/gallium/targets/egl/Makefile
1454 +++ b/src/gallium/targets/egl/Makefile
1455 @@ -24,7 +24,9 @@ common_CPPFLAGS := \
1456 -I$(TOP)/src/gallium/auxiliary \
1457 -I$(TOP)/src/gallium/drivers \
1458 -I$(TOP)/src/gallium/include \
1459 - -I$(TOP)/src/gallium/winsys
1460 + -I$(TOP)/src/gallium/winsys \
1465 $(TOP)/src/gallium/drivers/identity/libidentity.a \
1466 @@ -41,11 +43,11 @@ egl_SYS := -lm $(DLOPEN_LIBS) -L$(TOP)/$(LIB_DIR) -lEGL
1467 egl_LIBS := $(TOP)/src/gallium/state_trackers/egl/libegl.a
1469 ifneq ($(findstring x11, $(EGL_PLATFORMS)),)
1470 -egl_SYS += -lX11 -lXext -lXfixes
1471 +egl_SYS += -lX11 -lXext -lXfixes $(LIBDRM_LIB)
1472 egl_LIBS += $(TOP)/src/gallium/winsys/sw/xlib/libws_xlib.a
1474 -ifneq ($(findstring kms, $(EGL_PLATFORMS)),)
1476 +ifneq ($(findstring drm, $(EGL_PLATFORMS)),)
1477 +egl_SYS += $(LIBDRM_LIB)
1479 ifneq ($(findstring fbdev, $(EGL_PLATFORMS)),)
1480 egl_LIBS += $(TOP)/src/gallium/winsys/sw/fbdev/libfbdev.a
1481 diff --git a/src/gallium/targets/egl/pipe_i965.c b/src/gallium/targets/egl/pipe_i965.c
1482 index 43bf646..36b03b3 100644
1483 --- a/src/gallium/targets/egl/pipe_i965.c
1484 +++ b/src/gallium/targets/egl/pipe_i965.c
1487 #include "target-helpers/inline_wrapper_sw_helper.h"
1488 #include "target-helpers/inline_debug_helper.h"
1489 +#include "target-helpers/inline_wrapper_sw_helper.h"
1490 #include "state_tracker/drm_driver.h"
1491 #include "i965/drm/i965_drm_public.h"
1492 #include "i965/brw_public.h"
1493 diff --git a/src/gallium/targets/xorg-vmwgfx/vmw_ctrl.c b/src/gallium/targets/xorg-vmwgfx/vmw_ctrl.c
1494 index 237b308..9b422e6 100644
1495 --- a/src/gallium/targets/xorg-vmwgfx/vmw_ctrl.c
1496 +++ b/src/gallium/targets/xorg-vmwgfx/vmw_ctrl.c
1498 * allows X clients to communicate with the driver.
1501 +#include <xorg-server.h>
1502 #include "dixstruct.h"
1503 #include "extnsionst.h"
1505 @@ -211,7 +212,7 @@ VMwareCtrlDoSetTopology(ScrnInfoPtr pScrn,
1506 struct vmw_customizer *vmw = vmw_customizer(xorg_customizer(pScrn));
1509 - rects = xcalloc(number, sizeof(*rects));
1510 + rects = calloc(number, sizeof(*rects));
1514 @@ -224,7 +225,7 @@ VMwareCtrlDoSetTopology(ScrnInfoPtr pScrn,
1516 vmw_ioctl_update_layout(vmw, number, rects);
1523 diff --git a/src/gallium/targets/xorg-vmwgfx/vmw_ioctl.c b/src/gallium/targets/xorg-vmwgfx/vmw_ioctl.c
1524 index 7c799b5..7625d2f 100644
1525 --- a/src/gallium/targets/xorg-vmwgfx/vmw_ioctl.c
1526 +++ b/src/gallium/targets/xorg-vmwgfx/vmw_ioctl.c
1527 @@ -165,7 +165,7 @@ vmw_ioctl_buffer_create(struct vmw_customizer *vmw, uint32_t size, unsigned *han
1528 struct drm_vmw_dmabuf_rep *rep = &arg.rep;
1531 - buf = xcalloc(1, sizeof(*buf));
1532 + buf = calloc(1, sizeof(*buf));
1536 @@ -192,7 +192,7 @@ vmw_ioctl_buffer_create(struct vmw_customizer *vmw, uint32_t size, unsigned *han
1545 @@ -211,7 +211,7 @@ vmw_ioctl_buffer_destroy(struct vmw_customizer *vmw, struct vmw_dma_buffer *buf)
1546 arg.handle = buf->handle;
1547 drmCommandWrite(vmw->fd, DRM_VMW_UNREF_DMABUF, &arg, sizeof(arg));
1554 diff --git a/src/gallium/targets/xorg-vmwgfx/vmw_screen.c b/src/gallium/targets/xorg-vmwgfx/vmw_screen.c
1555 index 8173908..7662203 100644
1556 --- a/src/gallium/targets/xorg-vmwgfx/vmw_screen.c
1557 +++ b/src/gallium/targets/xorg-vmwgfx/vmw_screen.c
1558 @@ -245,6 +245,7 @@ vmw_screen_pre_init(ScrnInfoPtr pScrn, int flags)
1559 cust->winsys_enter_vt = vmw_screen_enter_vt;
1560 cust->winsys_leave_vt = vmw_screen_leave_vt;
1562 + cust->unhidden_hw_cursor_update = TRUE;
1565 pScrn->driverPrivate = cust;
1566 diff --git a/src/gallium/targets/xorg-vmwgfx/vmw_video.c b/src/gallium/targets/xorg-vmwgfx/vmw_video.c
1567 index eced60d..94465e5 100644
1568 --- a/src/gallium/targets/xorg-vmwgfx/vmw_video.c
1569 +++ b/src/gallium/targets/xorg-vmwgfx/vmw_video.c
1570 @@ -300,7 +300,7 @@ vmw_video_init(struct vmw_customizer *vmw)
1572 overlayAdaptors = &newAdaptor;
1574 - newAdaptors = xalloc((numAdaptors + 1) *
1575 + newAdaptors = malloc((numAdaptors + 1) *
1576 sizeof(XF86VideoAdaptorPtr*));
1578 xf86XVFreeVideoAdaptorRec(newAdaptor);
1579 @@ -320,7 +320,7 @@ vmw_video_init(struct vmw_customizer *vmw)
1583 - xfree(newAdaptors);
1584 + free(newAdaptors);
1587 debug_printf("Initialized VMware Xv extension successfully\n");
1588 @@ -438,7 +438,7 @@ vmw_video_init_adaptor(ScrnInfoPtr pScrn, struct vmw_customizer *vmw)
1592 - video = xcalloc(1, sizeof(*video));
1593 + video = calloc(1, sizeof(*video));
1595 debug_printf("Not enough memory.\n");
1596 xf86XVFreeVideoAdaptorRec(adaptor);
1597 @@ -742,7 +742,7 @@ vmw_video_buffer_alloc(struct vmw_customizer *vmw, int size,
1601 - out->extra_data = xcalloc(1, size);
1602 + out->extra_data = calloc(1, size);
1604 debug_printf("\t\t%s: allocated buffer %p of size %i\n", __func__, out, size);
1606 @@ -773,7 +773,7 @@ vmw_video_buffer_free(struct vmw_customizer *vmw,
1610 - xfree(out->extra_data);
1611 + free(out->extra_data);
1612 vmw_ioctl_buffer_unmap(vmw, out->buf);
1613 vmw_ioctl_buffer_destroy(vmw, out->buf);
1615 diff --git a/src/gallium/winsys/radeon/drm/radeon_drm.h b/src/gallium/winsys/radeon/drm/radeon_drm.h
1616 index df6dd91..061229f 100644
1617 --- a/src/gallium/winsys/radeon/drm/radeon_drm.h
1618 +++ b/src/gallium/winsys/radeon/drm/radeon_drm.h
1620 * I believe that this check is valid, but I haven't been exhaustive. */
1621 static INLINE boolean is_r3xx(int pciid)
1623 - return (pciid > 0x3150) && (pciid < 0x796f);
1625 + case 0x4144: /* PCI_CHIP_R300_AD */
1626 + case 0x4145: /* PCI_CHIP_R300_AE */
1627 + case 0x4146: /* PCI_CHIP_R300_AF */
1628 + case 0x4147: /* PCI_CHIP_R300_AG */
1629 + case 0x4E44: /* PCI_CHIP_R300_ND */
1630 + case 0x4E45: /* PCI_CHIP_R300_NE */
1631 + case 0x4E46: /* PCI_CHIP_R300_NF */
1632 + case 0x4E47: /* PCI_CHIP_R300_NG */
1633 + case 0x4E48: /* PCI_CHIP_R350_NH */
1634 + case 0x4E49: /* PCI_CHIP_R350_NI */
1635 + case 0x4E4B: /* PCI_CHIP_R350_NK */
1636 + case 0x4148: /* PCI_CHIP_R350_AH */
1637 + case 0x4149: /* PCI_CHIP_R350_AI */
1638 + case 0x414A: /* PCI_CHIP_R350_AJ */
1639 + case 0x414B: /* PCI_CHIP_R350_AK */
1640 + case 0x4E4A: /* PCI_CHIP_R360_NJ */
1641 + case 0x4150: /* PCI_CHIP_RV350_AP */
1642 + case 0x4151: /* PCI_CHIP_RV350_AQ */
1643 + case 0x4152: /* PCI_CHIP_RV350_AR */
1644 + case 0x4153: /* PCI_CHIP_RV350_AS */
1645 + case 0x4154: /* PCI_CHIP_RV350_AT */
1646 + case 0x4155: /* PCI_CHIP_RV350_AU */
1647 + case 0x4156: /* PCI_CHIP_RV350_AV */
1648 + case 0x4E50: /* PCI_CHIP_RV350_NP */
1649 + case 0x4E51: /* PCI_CHIP_RV350_NQ */
1650 + case 0x4E52: /* PCI_CHIP_RV350_NR */
1651 + case 0x4E53: /* PCI_CHIP_RV350_NS */
1652 + case 0x4E54: /* PCI_CHIP_RV350_NT */
1653 + case 0x4E56: /* PCI_CHIP_RV350_NV */
1654 + case 0x5460: /* PCI_CHIP_RV370_5460 */
1655 + case 0x5462: /* PCI_CHIP_RV370_5462 */
1656 + case 0x5464: /* PCI_CHIP_RV370_5464 */
1657 + case 0x5B60: /* PCI_CHIP_RV370_5B60 */
1658 + case 0x5B62: /* PCI_CHIP_RV370_5B62 */
1659 + case 0x5B63: /* PCI_CHIP_RV370_5B63 */
1660 + case 0x5B64: /* PCI_CHIP_RV370_5B64 */
1661 + case 0x5B65: /* PCI_CHIP_RV370_5B65 */
1662 + case 0x3150: /* PCI_CHIP_RV380_3150 */
1663 + case 0x3152: /* PCI_CHIP_RV380_3152 */
1664 + case 0x3154: /* PCI_CHIP_RV380_3154 */
1665 + case 0x3155: /* PCI_CHIP_RV380_3155 */
1666 + case 0x3E50: /* PCI_CHIP_RV380_3E50 */
1667 + case 0x3E54: /* PCI_CHIP_RV380_3E54 */
1668 + case 0x4A48: /* PCI_CHIP_R420_JH */
1669 + case 0x4A49: /* PCI_CHIP_R420_JI */
1670 + case 0x4A4A: /* PCI_CHIP_R420_JJ */
1671 + case 0x4A4B: /* PCI_CHIP_R420_JK */
1672 + case 0x4A4C: /* PCI_CHIP_R420_JL */
1673 + case 0x4A4D: /* PCI_CHIP_R420_JM */
1674 + case 0x4A4E: /* PCI_CHIP_R420_JN */
1675 + case 0x4A4F: /* PCI_CHIP_R420_JO */
1676 + case 0x4A50: /* PCI_CHIP_R420_JP */
1677 + case 0x4A54: /* PCI_CHIP_R420_JT */
1678 + case 0x5548: /* PCI_CHIP_R423_UH */
1679 + case 0x5549: /* PCI_CHIP_R423_UI */
1680 + case 0x554A: /* PCI_CHIP_R423_UJ */
1681 + case 0x554B: /* PCI_CHIP_R423_UK */
1682 + case 0x5550: /* PCI_CHIP_R423_5550 */
1683 + case 0x5551: /* PCI_CHIP_R423_UQ */
1684 + case 0x5552: /* PCI_CHIP_R423_UR */
1685 + case 0x5554: /* PCI_CHIP_R423_UT */
1686 + case 0x5D57: /* PCI_CHIP_R423_5D57 */
1687 + case 0x554C: /* PCI_CHIP_R430_554C */
1688 + case 0x554D: /* PCI_CHIP_R430_554D */
1689 + case 0x554E: /* PCI_CHIP_R430_554E */
1690 + case 0x554F: /* PCI_CHIP_R430_554F */
1691 + case 0x5D48: /* PCI_CHIP_R430_5D48 */
1692 + case 0x5D49: /* PCI_CHIP_R430_5D49 */
1693 + case 0x5D4A: /* PCI_CHIP_R430_5D4A */
1694 + case 0x5D4C: /* PCI_CHIP_R480_5D4C */
1695 + case 0x5D4D: /* PCI_CHIP_R480_5D4D */
1696 + case 0x5D4E: /* PCI_CHIP_R480_5D4E */
1697 + case 0x5D4F: /* PCI_CHIP_R480_5D4F */
1698 + case 0x5D50: /* PCI_CHIP_R480_5D50 */
1699 + case 0x5D52: /* PCI_CHIP_R480_5D52 */
1700 + case 0x4B49: /* PCI_CHIP_R481_4B49 */
1701 + case 0x4B4A: /* PCI_CHIP_R481_4B4A */
1702 + case 0x4B4B: /* PCI_CHIP_R481_4B4B */
1703 + case 0x4B4C: /* PCI_CHIP_R481_4B4C */
1704 + case 0x564A: /* PCI_CHIP_RV410_564A */
1705 + case 0x564B: /* PCI_CHIP_RV410_564B */
1706 + case 0x564F: /* PCI_CHIP_RV410_564F */
1707 + case 0x5652: /* PCI_CHIP_RV410_5652 */
1708 + case 0x5653: /* PCI_CHIP_RV410_5653 */
1709 + case 0x5657: /* PCI_CHIP_RV410_5657 */
1710 + case 0x5E48: /* PCI_CHIP_RV410_5E48 */
1711 + case 0x5E4A: /* PCI_CHIP_RV410_5E4A */
1712 + case 0x5E4B: /* PCI_CHIP_RV410_5E4B */
1713 + case 0x5E4C: /* PCI_CHIP_RV410_5E4C */
1714 + case 0x5E4D: /* PCI_CHIP_RV410_5E4D */
1715 + case 0x5E4F: /* PCI_CHIP_RV410_5E4F */
1716 + case 0x5A41: /* PCI_CHIP_RS400_5A41 */
1717 + case 0x5A42: /* PCI_CHIP_RS400_5A42 */
1718 + case 0x5A61: /* PCI_CHIP_RC410_5A61 */
1719 + case 0x5A62: /* PCI_CHIP_RC410_5A62 */
1720 + case 0x5954: /* PCI_CHIP_RS480_5954 */
1721 + case 0x5955: /* PCI_CHIP_RS480_5955 */
1722 + case 0x5974: /* PCI_CHIP_RS482_5974 */
1723 + case 0x5975: /* PCI_CHIP_RS482_5975 */
1724 + case 0x7100: /* PCI_CHIP_R520_7100 */
1725 + case 0x7101: /* PCI_CHIP_R520_7101 */
1726 + case 0x7102: /* PCI_CHIP_R520_7102 */
1727 + case 0x7103: /* PCI_CHIP_R520_7103 */
1728 + case 0x7104: /* PCI_CHIP_R520_7104 */
1729 + case 0x7105: /* PCI_CHIP_R520_7105 */
1730 + case 0x7106: /* PCI_CHIP_R520_7106 */
1731 + case 0x7108: /* PCI_CHIP_R520_7108 */
1732 + case 0x7109: /* PCI_CHIP_R520_7109 */
1733 + case 0x710A: /* PCI_CHIP_R520_710A */
1734 + case 0x710B: /* PCI_CHIP_R520_710B */
1735 + case 0x710C: /* PCI_CHIP_R520_710C */
1736 + case 0x710E: /* PCI_CHIP_R520_710E */
1737 + case 0x710F: /* PCI_CHIP_R520_710F */
1738 + case 0x7140: /* PCI_CHIP_RV515_7140 */
1739 + case 0x7141: /* PCI_CHIP_RV515_7141 */
1740 + case 0x7142: /* PCI_CHIP_RV515_7142 */
1741 + case 0x7143: /* PCI_CHIP_RV515_7143 */
1742 + case 0x7144: /* PCI_CHIP_RV515_7144 */
1743 + case 0x7145: /* PCI_CHIP_RV515_7145 */
1744 + case 0x7146: /* PCI_CHIP_RV515_7146 */
1745 + case 0x7147: /* PCI_CHIP_RV515_7147 */
1746 + case 0x7149: /* PCI_CHIP_RV515_7149 */
1747 + case 0x714A: /* PCI_CHIP_RV515_714A */
1748 + case 0x714B: /* PCI_CHIP_RV515_714B */
1749 + case 0x714C: /* PCI_CHIP_RV515_714C */
1750 + case 0x714D: /* PCI_CHIP_RV515_714D */
1751 + case 0x714E: /* PCI_CHIP_RV515_714E */
1752 + case 0x714F: /* PCI_CHIP_RV515_714F */
1753 + case 0x7151: /* PCI_CHIP_RV515_7151 */
1754 + case 0x7152: /* PCI_CHIP_RV515_7152 */
1755 + case 0x7153: /* PCI_CHIP_RV515_7153 */
1756 + case 0x715E: /* PCI_CHIP_RV515_715E */
1757 + case 0x715F: /* PCI_CHIP_RV515_715F */
1758 + case 0x7180: /* PCI_CHIP_RV515_7180 */
1759 + case 0x7181: /* PCI_CHIP_RV515_7181 */
1760 + case 0x7183: /* PCI_CHIP_RV515_7183 */
1761 + case 0x7186: /* PCI_CHIP_RV515_7186 */
1762 + case 0x7187: /* PCI_CHIP_RV515_7187 */
1763 + case 0x7188: /* PCI_CHIP_RV515_7188 */
1764 + case 0x718A: /* PCI_CHIP_RV515_718A */
1765 + case 0x718B: /* PCI_CHIP_RV515_718B */
1766 + case 0x718C: /* PCI_CHIP_RV515_718C */
1767 + case 0x718D: /* PCI_CHIP_RV515_718D */
1768 + case 0x718F: /* PCI_CHIP_RV515_718F */
1769 + case 0x7193: /* PCI_CHIP_RV515_7193 */
1770 + case 0x7196: /* PCI_CHIP_RV515_7196 */
1771 + case 0x719B: /* PCI_CHIP_RV515_719B */
1772 + case 0x719F: /* PCI_CHIP_RV515_719F */
1773 + case 0x7200: /* PCI_CHIP_RV515_7200 */
1774 + case 0x7210: /* PCI_CHIP_RV515_7210 */
1775 + case 0x7211: /* PCI_CHIP_RV515_7211 */
1776 + case 0x71C0: /* PCI_CHIP_RV530_71C0 */
1777 + case 0x71C1: /* PCI_CHIP_RV530_71C1 */
1778 + case 0x71C2: /* PCI_CHIP_RV530_71C2 */
1779 + case 0x71C3: /* PCI_CHIP_RV530_71C3 */
1780 + case 0x71C4: /* PCI_CHIP_RV530_71C4 */
1781 + case 0x71C5: /* PCI_CHIP_RV530_71C5 */
1782 + case 0x71C6: /* PCI_CHIP_RV530_71C6 */
1783 + case 0x71C7: /* PCI_CHIP_RV530_71C7 */
1784 + case 0x71CD: /* PCI_CHIP_RV530_71CD */
1785 + case 0x71CE: /* PCI_CHIP_RV530_71CE */
1786 + case 0x71D2: /* PCI_CHIP_RV530_71D2 */
1787 + case 0x71D4: /* PCI_CHIP_RV530_71D4 */
1788 + case 0x71D5: /* PCI_CHIP_RV530_71D5 */
1789 + case 0x71D6: /* PCI_CHIP_RV530_71D6 */
1790 + case 0x71DA: /* PCI_CHIP_RV530_71DA */
1791 + case 0x71DE: /* PCI_CHIP_RV530_71DE */
1792 + case 0x7281: /* PCI_CHIP_RV560_7281 */
1793 + case 0x7283: /* PCI_CHIP_RV560_7283 */
1794 + case 0x7287: /* PCI_CHIP_RV560_7287 */
1795 + case 0x7290: /* PCI_CHIP_RV560_7290 */
1796 + case 0x7291: /* PCI_CHIP_RV560_7291 */
1797 + case 0x7293: /* PCI_CHIP_RV560_7293 */
1798 + case 0x7297: /* PCI_CHIP_RV560_7297 */
1799 + case 0x7280: /* PCI_CHIP_RV570_7280 */
1800 + case 0x7288: /* PCI_CHIP_RV570_7288 */
1801 + case 0x7289: /* PCI_CHIP_RV570_7289 */
1802 + case 0x728B: /* PCI_CHIP_RV570_728B */
1803 + case 0x728C: /* PCI_CHIP_RV570_728C */
1804 + case 0x7240: /* PCI_CHIP_R580_7240 */
1805 + case 0x7243: /* PCI_CHIP_R580_7243 */
1806 + case 0x7244: /* PCI_CHIP_R580_7244 */
1807 + case 0x7245: /* PCI_CHIP_R580_7245 */
1808 + case 0x7246: /* PCI_CHIP_R580_7246 */
1809 + case 0x7247: /* PCI_CHIP_R580_7247 */
1810 + case 0x7248: /* PCI_CHIP_R580_7248 */
1811 + case 0x7249: /* PCI_CHIP_R580_7249 */
1812 + case 0x724A: /* PCI_CHIP_R580_724A */
1813 + case 0x724B: /* PCI_CHIP_R580_724B */
1814 + case 0x724C: /* PCI_CHIP_R580_724C */
1815 + case 0x724D: /* PCI_CHIP_R580_724D */
1816 + case 0x724E: /* PCI_CHIP_R580_724E */
1817 + case 0x724F: /* PCI_CHIP_R580_724F */
1818 + case 0x7284: /* PCI_CHIP_R580_7284 */
1819 + case 0x793F: /* PCI_CHIP_RS600_793F */
1820 + case 0x7941: /* PCI_CHIP_RS600_7941 */
1821 + case 0x7942: /* PCI_CHIP_RS600_7942 */
1822 + case 0x791E: /* PCI_CHIP_RS690_791E */
1823 + case 0x791F: /* PCI_CHIP_RS690_791F */
1824 + case 0x796C: /* PCI_CHIP_RS740_796C */
1825 + case 0x796D: /* PCI_CHIP_RS740_796D */
1826 + case 0x796E: /* PCI_CHIP_RS740_796E */
1827 + case 0x796F: /* PCI_CHIP_RS740_796F */
1835 diff --git a/src/glsl/glsl_parser.cpp b/src/glsl/glsl_parser.cpp
1836 index 301c221..ad99eee 100644
1837 --- a/src/glsl/glsl_parser.cpp
1838 +++ b/src/glsl/glsl_parser.cpp
1840 -/* A Bison parser, made by GNU Bison 2.4.3. */
1841 +/* A Bison parser, made by GNU Bison 2.4.2. */
1843 /* Skeleton implementation for Bison's Yacc-like parsers in C
1845 - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
1846 - 2009, 2010 Free Software Foundation, Inc.
1847 + Copyright (C) 1984, 1989-1990, 2000-2006, 2009-2010 Free Software
1850 This program is free software: you can redistribute it and/or modify
1851 it under the terms of the GNU General Public License as published by
1855 /* Bison version. */
1856 -#define YYBISON_VERSION "2.4.3"
1857 +#define YYBISON_VERSION "2.4.2"
1859 /* Skeleton name. */
1860 #define YYSKELETON_NAME "yacc.c"
1861 @@ -2621,7 +2621,7 @@ YYLTYPE yylloc;
1864 /* The locations where the error started and ended. */
1865 - YYLTYPE yyerror_range[3];
1866 + YYLTYPE yyerror_range[2];
1868 YYSIZE_T yystacksize;
1870 @@ -5084,7 +5084,7 @@ yyerrlab:
1874 - yyerror_range[1] = yylloc;
1875 + yyerror_range[0] = yylloc;
1877 if (yyerrstatus == 3)
1879 @@ -5121,7 +5121,7 @@ yyerrorlab:
1880 if (/*CONSTCOND*/ 0)
1883 - yyerror_range[1] = yylsp[1-yylen];
1884 + yyerror_range[0] = yylsp[1-yylen];
1885 /* Do not reclaim the symbols of the rule which action triggered
1888 @@ -5155,7 +5155,7 @@ yyerrlab1:
1892 - yyerror_range[1] = *yylsp;
1893 + yyerror_range[0] = *yylsp;
1894 yydestruct ("Error: popping",
1895 yystos[yystate], yyvsp, yylsp, state);
1897 @@ -5165,10 +5165,10 @@ yyerrlab1:
1901 - yyerror_range[2] = yylloc;
1902 + yyerror_range[1] = yylloc;
1903 /* Using YYLLOC is tempting, but would change the location of
1904 the lookahead. YYLOC is available though. */
1905 - YYLLOC_DEFAULT (yyloc, yyerror_range, 2);
1906 + YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 2);
1909 /* Shift the error token. */
1910 diff --git a/src/glsl/glsl_parser.h b/src/glsl/glsl_parser.h
1911 index 4a78037..266a4a2 100644
1912 --- a/src/glsl/glsl_parser.h
1913 +++ b/src/glsl/glsl_parser.h
1915 -/* A Bison parser, made by GNU Bison 2.4.3. */
1916 +/* A Bison parser, made by GNU Bison 2.4.2. */
1918 /* Skeleton interface for Bison's Yacc-like parsers in C
1920 - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
1921 - 2009, 2010 Free Software Foundation, Inc.
1922 + Copyright (C) 1984, 1989-1990, 2000-2006, 2009-2010 Free Software
1925 This program is free software: you can redistribute it and/or modify
1926 it under the terms of the GNU General Public License as published by
1927 diff --git a/src/mesa/Makefile b/src/mesa/Makefile
1928 index c41c38c..8b0756b 100644
1929 --- a/src/mesa/Makefile
1930 +++ b/src/mesa/Makefile
1931 @@ -34,9 +34,9 @@ ES1_CPPFLAGS := -DFEATURE_ES1=1 $(DEFINES)
1932 ES2_CPPFLAGS := -DFEATURE_ES2=1 $(DEFINES)
1934 # append include dirs
1935 -MESA_CPPFLAGS += $(INCLUDE_DIRS)
1936 -ES1_CPPFLAGS += -I$(TOP)/src/mapi/es1api $(INCLUDE_DIRS)
1937 -ES2_CPPFLAGS += -I$(TOP)/src/mapi/es2api $(INCLUDE_DIRS)
1938 +MESA_CPPFLAGS += $(INCLUDE_DIRS) $(TALLOC_CFLAGS)
1939 +ES1_CPPFLAGS += -I$(TOP)/src/mapi/es1api $(INCLUDE_DIRS) $(TALLOC_CFLAGS)
1940 +ES2_CPPFLAGS += -I$(TOP)/src/mapi/es2api $(INCLUDE_DIRS) $(TALLOC_CFLAGS)
1942 # tidy compiler flags
1943 CFLAGS := $(filter-out $(DEFINES), $(CFLAGS))
1944 diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
1945 index a03cb68..20dda5f 100644
1946 --- a/src/mesa/drivers/common/meta.c
1947 +++ b/src/mesa/drivers/common/meta.c
1948 @@ -1385,6 +1385,7 @@ _mesa_meta_Clear(GLcontext *ctx, GLbitfield buffers)
1949 struct vertex verts[4];
1950 /* save all state but scissor, pixel pack/unpack */
1951 GLbitfield metaSave = META_ALL - META_SCISSOR - META_PIXEL_STORE;
1952 + const GLuint stencilMax = (1 << ctx->DrawBuffer->Visual.stencilBits) - 1;
1954 if (buffers & BUFFER_BITS_COLOR) {
1955 /* if clearing color buffers, don't save/restore colormask */
1956 @@ -1440,7 +1441,7 @@ _mesa_meta_Clear(GLcontext *ctx, GLbitfield buffers)
1957 _mesa_StencilOpSeparate(GL_FRONT_AND_BACK,
1958 GL_REPLACE, GL_REPLACE, GL_REPLACE);
1959 _mesa_StencilFuncSeparate(GL_FRONT_AND_BACK, GL_ALWAYS,
1960 - ctx->Stencil.Clear & 0x7fffffff,
1961 + ctx->Stencil.Clear & stencilMax,
1962 ctx->Stencil.WriteMask[0]);
1965 diff --git a/src/mesa/drivers/dri/r200/r200_swtcl.c b/src/mesa/drivers/dri/r200/r200_swtcl.c
1966 index dbf4ad4..160e7e7 100644
1967 --- a/src/mesa/drivers/dri/r200/r200_swtcl.c
1968 +++ b/src/mesa/drivers/dri/r200/r200_swtcl.c
1969 @@ -319,10 +319,9 @@ static INLINE GLuint reduced_hw_prim( GLcontext *ctx, GLuint prim)
1973 - return (ctx->Point.PointSprite ||
1974 - ((ctx->_TriangleCaps & (DD_POINT_SIZE | DD_POINT_ATTEN)) &&
1975 - !(ctx->_TriangleCaps & (DD_POINT_SMOOTH)))) ?
1976 - R200_VF_PRIM_POINT_SPRITES : R200_VF_PRIM_POINTS;
1977 + return (((R200_CONTEXT(ctx))->radeon.radeonScreen->drmSupportsPointSprites &&
1978 + !(ctx->_TriangleCaps & DD_POINT_SMOOTH)) ?
1979 + R200_VF_PRIM_POINT_SPRITES : R200_VF_PRIM_POINTS);
1983 @@ -613,6 +612,9 @@ static void r200RasterPrimitive( GLcontext *ctx, GLuint hwprim )
1984 r200ContextPtr rmesa = R200_CONTEXT(ctx);
1986 radeon_prepare_render(&rmesa->radeon);
1987 + if (rmesa->radeon.NewGLState)
1988 + r200ValidateState( ctx );
1991 if (rmesa->radeon.swtcl.hw_primitive != hwprim) {
1992 /* need to disable perspective-correct texturing for point sprites */
1993 diff --git a/src/mesa/drivers/dri/r200/r200_tcl.c b/src/mesa/drivers/dri/r200/r200_tcl.c
1994 index 4ae0f30..2743997 100644
1995 --- a/src/mesa/drivers/dri/r200/r200_tcl.c
1996 +++ b/src/mesa/drivers/dri/r200/r200_tcl.c
1997 @@ -68,9 +68,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2001 -#define HW_POINTS ((ctx->Point.PointSprite || \
2002 - ((ctx->_TriangleCaps & (DD_POINT_SIZE | DD_POINT_ATTEN)) && \
2003 - !(ctx->_TriangleCaps & (DD_POINT_SMOOTH)))) ? \
2004 +#define HW_POINTS (((R200_CONTEXT(ctx))->radeon.radeonScreen->drmSupportsPointSprites && \
2005 + !(ctx->_TriangleCaps & DD_POINT_SMOOTH)) ? \
2006 R200_VF_PRIM_POINT_SPRITES : R200_VF_PRIM_POINTS)
2007 #define HW_LINES R200_VF_PRIM_LINES
2008 #define HW_LINE_LOOP 0
2009 @@ -265,6 +264,8 @@ void r200TclPrimitive( GLcontext *ctx,
2010 GLuint newprim = hw_prim | R200_VF_TCL_OUTPUT_VTX_ENABLE;
2012 radeon_prepare_render(&rmesa->radeon);
2013 + if (rmesa->radeon.NewGLState)
2014 + r200ValidateState( ctx );
2016 if (newprim != rmesa->tcl.hw_primitive ||
2017 !discrete_prim[hw_prim&0xf]) {
2018 diff --git a/src/mesa/drivers/dri/r300/compiler/r300_fragprog_emit.c b/src/mesa/drivers/dri/r300/compiler/r300_fragprog_emit.c
2019 index 3b2b06f..9f19f8f 100644
2020 --- a/src/mesa/drivers/dri/r300/compiler/r300_fragprog_emit.c
2021 +++ b/src/mesa/drivers/dri/r300/compiler/r300_fragprog_emit.c
2022 @@ -76,6 +76,9 @@ static void use_temporary(struct r300_fragment_program_code *code, unsigned int
2024 static unsigned int use_source(struct r300_fragment_program_code* code, struct radeon_pair_instruction_source src)
2029 if (src.File == RC_FILE_CONSTANT) {
2030 return src.Index | (1 << 5);
2031 } else if (src.File == RC_FILE_TEMPORARY) {
2032 diff --git a/src/mesa/drivers/dri/r300/compiler/r300_fragprog_swizzle.c b/src/mesa/drivers/dri/r300/compiler/r300_fragprog_swizzle.c
2033 index caa48fe..1aa40c7 100644
2034 --- a/src/mesa/drivers/dri/r300/compiler/r300_fragprog_swizzle.c
2035 +++ b/src/mesa/drivers/dri/r300/compiler/r300_fragprog_swizzle.c
2036 @@ -94,6 +94,10 @@ static const struct swizzle_data* lookup_native_swizzle(unsigned int swizzle)
2038 static int r300_swizzle_is_native(rc_opcode opcode, struct rc_src_register reg)
2040 + const struct swizzle_data* sd;
2041 + unsigned int relevant;
2045 reg.Negate = RC_MASK_NONE;
2047 @@ -117,8 +121,7 @@ static int r300_swizzle_is_native(rc_opcode opcode, struct rc_src_register reg)
2051 - unsigned int relevant = 0;
2055 for(j = 0; j < 3; ++j)
2056 if (GET_SWZ(reg.Swizzle, j) != RC_SWIZZLE_UNUSED)
2057 @@ -127,7 +130,8 @@ static int r300_swizzle_is_native(rc_opcode opcode, struct rc_src_register reg)
2058 if ((reg.Negate & relevant) && ((reg.Negate & relevant) != relevant))
2061 - if (!lookup_native_swizzle(reg.Swizzle))
2062 + sd = lookup_native_swizzle(reg.Swizzle);
2063 + if (!sd || (reg.File == RC_FILE_PRESUB && sd->srcp_stride == 0))
2067 @@ -200,7 +204,7 @@ unsigned int r300FPTranslateRGBSwizzle(unsigned int src, unsigned int swizzle)
2069 const struct swizzle_data* sd = lookup_native_swizzle(swizzle);
2072 + if (!sd || (src == RC_PAIR_PRESUB_SRC && sd->srcp_stride == 0)) {
2073 fprintf(stderr, "Not a native swizzle: %08x\n", swizzle);
2076 diff --git a/src/mesa/drivers/dri/r300/compiler/r3xx_fragprog.c b/src/mesa/drivers/dri/r300/compiler/r3xx_fragprog.c
2077 index 4793f33..d9a398d 100644
2078 --- a/src/mesa/drivers/dri/r300/compiler/r3xx_fragprog.c
2079 +++ b/src/mesa/drivers/dri/r300/compiler/r3xx_fragprog.c
2080 @@ -54,6 +54,8 @@ static void rc_rewrite_depth_out(struct radeon_compiler *cc, void *user)
2082 for (rci = c->Base.Program.Instructions.Next; rci != &c->Base.Program.Instructions; rci = rci->Next) {
2083 struct rc_sub_instruction * inst = &rci->U.I;
2085 + const struct rc_opcode_info *info = rc_get_opcode_info(inst->Opcode);
2087 if (inst->DstReg.File != RC_FILE_OUTPUT || inst->DstReg.Index != c->OutputDepth)
2089 @@ -65,27 +67,12 @@ static void rc_rewrite_depth_out(struct radeon_compiler *cc, void *user)
2093 - switch (inst->Opcode) {
2094 - case RC_OPCODE_FRC:
2095 - case RC_OPCODE_MOV:
2096 - inst->SrcReg[0] = lmul_swizzle(RC_SWIZZLE_ZZZZ, inst->SrcReg[0]);
2098 - case RC_OPCODE_ADD:
2099 - case RC_OPCODE_MAX:
2100 - case RC_OPCODE_MIN:
2101 - case RC_OPCODE_MUL:
2102 - inst->SrcReg[0] = lmul_swizzle(RC_SWIZZLE_ZZZZ, inst->SrcReg[0]);
2103 - inst->SrcReg[1] = lmul_swizzle(RC_SWIZZLE_ZZZZ, inst->SrcReg[1]);
2105 - case RC_OPCODE_CMP:
2106 - case RC_OPCODE_MAD:
2107 - inst->SrcReg[0] = lmul_swizzle(RC_SWIZZLE_ZZZZ, inst->SrcReg[0]);
2108 - inst->SrcReg[1] = lmul_swizzle(RC_SWIZZLE_ZZZZ, inst->SrcReg[1]);
2109 - inst->SrcReg[2] = lmul_swizzle(RC_SWIZZLE_ZZZZ, inst->SrcReg[2]);
2112 - // Scalar instructions needn't be reswizzled
2114 + if (!info->IsComponentwise) {
2118 + for (i = 0; i < info->NumSrcRegs; i++) {
2119 + inst->SrcReg[i] = lmul_swizzle(RC_SWIZZLE_ZZZZ, inst->SrcReg[i]);
2123 diff --git a/src/mesa/drivers/dri/r300/compiler/r500_fragprog_emit.c b/src/mesa/drivers/dri/r300/compiler/r500_fragprog_emit.c
2124 index efa3bb5..abbf704 100644
2125 --- a/src/mesa/drivers/dri/r300/compiler/r500_fragprog_emit.c
2126 +++ b/src/mesa/drivers/dri/r300/compiler/r500_fragprog_emit.c
2127 @@ -200,6 +200,9 @@ static void use_temporary(struct r500_fragment_program_code* code, unsigned int
2129 static unsigned int use_source(struct r500_fragment_program_code* code, struct radeon_pair_instruction_source src)
2134 if (src.File == RC_FILE_CONSTANT) {
2135 return src.Index | 0x100;
2136 } else if (src.File == RC_FILE_TEMPORARY) {
2137 diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_optimize.c b/src/mesa/drivers/dri/r300/compiler/radeon_optimize.c
2138 index 3be50b9..bebe806 100644
2139 --- a/src/mesa/drivers/dri/r300/compiler/radeon_optimize.c
2140 +++ b/src/mesa/drivers/dri/r300/compiler/radeon_optimize.c
2141 @@ -566,6 +566,7 @@ static int presub_helper(
2142 for(i = 0; i < info->NumSrcRegs; i++) {
2143 unsigned int mask = src_reads_dst_mask(
2144 inst->U.I.SrcReg[i], s->Inst->U.I.DstReg);
2145 + struct rc_src_register src = inst->U.I.SrcReg[i];
2146 /* XXX We could be more aggressive here using
2147 * presubtract. It is okay if SrcReg[i] only reads
2148 * from some of the mask components. */
2149 @@ -577,6 +578,11 @@ static int presub_helper(
2153 + src.File = RC_FILE_PRESUB;
2154 + if (!c->SwizzleCaps->IsNative(inst->U.I.Opcode, src)){
2158 if (cant_sub || !can_use_presub) {
2161 @@ -635,7 +641,9 @@ static void presub_replace_add(struct peephole_state *s,
2162 inst->U.I.SrcReg[src_index].Index = presub_opcode;
2165 -static int is_presub_candidate(struct rc_instruction * inst)
2166 +static int is_presub_candidate(
2167 + struct radeon_compiler * c,
2168 + struct rc_instruction * inst)
2170 const struct rc_opcode_info * info = rc_get_opcode_info(inst->U.I.Opcode);
2172 @@ -644,7 +652,12 @@ static int is_presub_candidate(struct rc_instruction * inst)
2175 for(i = 0; i < info->NumSrcRegs; i++) {
2176 - if (src_reads_dst_mask(inst->U.I.SrcReg[i], inst->U.I.DstReg))
2177 + struct rc_src_register src = inst->U.I.SrcReg[i];
2178 + if (src_reads_dst_mask(src, inst->U.I.DstReg))
2181 + src.File = RC_FILE_PRESUB;
2182 + if (!c->SwizzleCaps->IsNative(inst->U.I.Opcode, src))
2186 @@ -659,7 +672,7 @@ static int peephole_add_presub_add(
2188 struct peephole_state s;
2190 - if (!is_presub_candidate(inst_add))
2191 + if (!is_presub_candidate(c, inst_add))
2194 if (inst_add->U.I.SrcReg[0].Swizzle != inst_add->U.I.SrcReg[1].Swizzle)
2195 @@ -726,7 +739,7 @@ static int peephole_add_presub_inv(
2196 unsigned int i, swz, mask;
2197 struct peephole_state s;
2199 - if (!is_presub_candidate(inst_add))
2200 + if (!is_presub_candidate(c, inst_add))
2203 mask = inst_add->U.I.DstReg.WriteMask;
2204 diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_pair_regalloc.c b/src/mesa/drivers/dri/r300/compiler/radeon_pair_regalloc.c
2205 index c738455..126b50b 100644
2206 --- a/src/mesa/drivers/dri/r300/compiler/radeon_pair_regalloc.c
2207 +++ b/src/mesa/drivers/dri/r300/compiler/radeon_pair_regalloc.c
2208 @@ -66,10 +66,13 @@ struct regalloc_state {
2209 struct hardware_register * HwTemporary;
2210 unsigned int NumHwTemporaries;
2212 - * If an instruction is inside of a loop, end_loop will be the
2213 - * IP of the ENDLOOP instruction, otherwise end_loop will be 0
2214 + * If an instruction is inside of a loop, EndLoop will be the
2215 + * IP of the ENDLOOP instruction, and BeginLoop will be the IP
2216 + * of the BGNLOOP instruction. Otherwise, EndLoop and BeginLoop
2224 static void print_live_intervals(struct live_intervals * src)
2225 @@ -180,11 +183,13 @@ static void scan_callback(void * data, struct rc_instruction * inst,
2227 if (file == RC_FILE_INPUT)
2228 reg->Live.Start = -1;
2229 + else if (s->BeginLoop >= 0)
2230 + reg->Live.Start = s->BeginLoop;
2232 reg->Live.Start = inst->IP;
2233 reg->Live.End = inst->IP;
2234 - } else if (s->end_loop)
2235 - reg->Live.End = s->end_loop;
2236 + } else if (s->EndLoop >= 0)
2237 + reg->Live.End = s->EndLoop;
2238 else if (inst->IP > reg->Live.End)
2239 reg->Live.End = inst->IP;
2241 @@ -195,6 +200,8 @@ static void compute_live_intervals(struct radeon_compiler *c,
2242 memset(s, 0, sizeof(*s));
2244 s->NumHwTemporaries = c->max_temp_regs;
2245 + s->BeginLoop = -1;
2248 memory_pool_malloc(&c->Pool,
2249 s->NumHwTemporaries * sizeof(struct hardware_register));
2250 @@ -207,8 +214,10 @@ static void compute_live_intervals(struct radeon_compiler *c,
2251 inst = inst->Next) {
2253 /* For all instructions inside of a loop, the ENDLOOP
2254 - * instruction is used as the end of the live interval. */
2255 - if (inst->U.I.Opcode == RC_OPCODE_BGNLOOP && !s->end_loop) {
2256 + * instruction is used as the end of the live interval and
2257 + * the BGNLOOP instruction is used as the beginning. */
2258 + if (inst->U.I.Opcode == RC_OPCODE_BGNLOOP && s->EndLoop < 0) {
2259 + s->BeginLoop = inst->IP;
2261 struct rc_instruction * tmp;
2262 for(tmp = inst->Next;
2263 @@ -219,15 +228,17 @@ static void compute_live_intervals(struct radeon_compiler *c,
2264 } else if (tmp->U.I.Opcode
2265 == RC_OPCODE_ENDLOOP) {
2267 - s->end_loop = tmp->IP;
2268 + s->EndLoop = tmp->IP;
2275 - if (inst->IP == s->end_loop)
2277 + if (inst->IP == s->EndLoop) {
2279 + s->BeginLoop = -1;
2282 rc_for_all_reads_mask(inst, scan_callback, s);
2283 rc_for_all_writes_mask(inst, scan_callback, s);
2284 diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_pair_schedule.c b/src/mesa/drivers/dri/r300/compiler/radeon_pair_schedule.c
2285 index 7ab2df3..0b003d7 100644
2286 --- a/src/mesa/drivers/dri/r300/compiler/radeon_pair_schedule.c
2287 +++ b/src/mesa/drivers/dri/r300/compiler/radeon_pair_schedule.c
2288 @@ -126,15 +126,6 @@ static struct reg_value ** get_reg_valuep(struct schedule_state * s,
2289 return &s->Temporary[index].Values[chan];
2292 -static struct reg_value * get_reg_value(struct schedule_state * s,
2293 - rc_register_file file, unsigned int index, unsigned int chan)
2295 - struct reg_value ** pv = get_reg_valuep(s, file, index, chan);
2301 static void add_inst_to_list(struct schedule_instruction ** list, struct schedule_instruction * inst)
2303 inst->NextReady = *list;
2304 @@ -602,12 +593,13 @@ static void scan_read(void * data, struct rc_instruction * inst,
2305 rc_register_file file, unsigned int index, unsigned int chan)
2307 struct schedule_state * s = data;
2308 - struct reg_value * v = get_reg_value(s, file, index, chan);
2309 + struct reg_value ** v = get_reg_valuep(s, file, index, chan);
2310 + struct reg_value_reader * reader;
2315 - if (v->Writer == s->Current) {
2316 + if (*v && (*v)->Writer == s->Current) {
2317 /* The instruction reads and writes to a register component.
2318 * In this case, we only want to increment dependencies by one.
2320 @@ -616,18 +608,30 @@ static void scan_read(void * data, struct rc_instruction * inst,
2322 DBG("%i: read %i[%i] chan %i\n", s->Current->Instruction->IP, file, index, chan);
2324 - struct reg_value_reader * reader = memory_pool_malloc(&s->C->Pool, sizeof(*reader));
2325 + reader = memory_pool_malloc(&s->C->Pool, sizeof(*reader));
2326 reader->Reader = s->Current;
2327 - reader->Next = v->Readers;
2328 - v->Readers = reader;
2331 - s->Current->NumDependencies++;
2333 + /* In this situation, the instruction reads from a register
2334 + * that hasn't been written to or read from in the current
2336 + *v = memory_pool_malloc(&s->C->Pool, sizeof(struct reg_value));
2337 + memset(*v, 0, sizeof(struct reg_value));
2338 + (*v)->Readers = reader;
2340 + reader->Next = (*v)->Readers;
2341 + (*v)->Readers = reader;
2342 + /* Only update the current instruction's dependencies if the
2343 + * register it reads from has been written to in this block. */
2344 + if ((*v)->Writer) {
2345 + s->Current->NumDependencies++;
2348 + (*v)->NumReaders++;
2350 if (s->Current->NumReadValues >= 12) {
2351 rc_error(s->C, "%s: NumReadValues overflow\n", __FUNCTION__);
2353 - s->Current->ReadValues[s->Current->NumReadValues++] = v;
2354 + s->Current->ReadValues[s->Current->NumReadValues++] = *v;
2358 diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_pair_translate.c b/src/mesa/drivers/dri/r300/compiler/radeon_pair_translate.c
2359 index ff82584..840c7a5 100644
2360 --- a/src/mesa/drivers/dri/r300/compiler/radeon_pair_translate.c
2361 +++ b/src/mesa/drivers/dri/r300/compiler/radeon_pair_translate.c
2362 @@ -278,9 +278,12 @@ static void set_pair_instruction(struct r300_fragment_program_compiler *c,
2363 pair->RGB.DestIndex = inst->DstReg.Index;
2364 pair->RGB.WriteMask |= inst->DstReg.WriteMask & RC_MASK_XYZ;
2368 - pair->Alpha.DestIndex = inst->DstReg.Index;
2369 pair->Alpha.WriteMask |= GET_BIT(inst->DstReg.WriteMask, 3);
2370 + if (pair->Alpha.WriteMask) {
2371 + pair->Alpha.DestIndex = inst->DstReg.Index;
2376 diff --git a/src/mesa/drivers/dri/r300/r300_draw.c b/src/mesa/drivers/dri/r300/r300_draw.c
2377 index 5ae9f49..767778b 100644
2378 --- a/src/mesa/drivers/dri/r300/r300_draw.c
2379 +++ b/src/mesa/drivers/dri/r300/r300_draw.c
2380 @@ -717,6 +717,10 @@ static void r300DrawPrims(GLcontext *ctx,
2384 + struct r300_context *r300 = R300_CONTEXT(ctx);
2385 + radeonContextPtr radeon = &r300->radeon;
2387 + radeon_prepare_render(radeon);
2389 /* This check should get folded into just the places that
2390 * min/max index are really needed.
2391 diff --git a/src/mesa/drivers/dri/r300/r300_render.c b/src/mesa/drivers/dri/r300/r300_render.c
2392 index cf89ab7..bb8f914 100644
2393 --- a/src/mesa/drivers/dri/r300/r300_render.c
2394 +++ b/src/mesa/drivers/dri/r300/r300_render.c
2395 @@ -327,8 +327,6 @@ void r300RunRenderPrimitive(GLcontext * ctx, int start, int end, int prim)
2396 BATCH_LOCALS(&rmesa->radeon);
2397 int type, num_verts;
2399 - radeon_prepare_render(&rmesa->radeon);
2401 type = r300PrimitiveType(rmesa, prim);
2402 num_verts = r300NumVerts(rmesa, end - start, prim);
2404 diff --git a/src/mesa/drivers/dri/r600/evergreen_render.c b/src/mesa/drivers/dri/r600/evergreen_render.c
2405 index 27089bf..1fa53d7 100644
2406 --- a/src/mesa/drivers/dri/r600/evergreen_render.c
2407 +++ b/src/mesa/drivers/dri/r600/evergreen_render.c
2408 @@ -909,6 +909,10 @@ static void evergreenDrawPrims(GLcontext *ctx,
2410 GLboolean retval = GL_FALSE;
2412 + context_t *context = EVERGREEN_CONTEXT(ctx);
2413 + radeonContextPtr radeon = &context->radeon;
2414 + radeon_prepare_render(radeon);
2416 /* This check should get folded into just the places that
2417 * min/max index are really needed.
2419 diff --git a/src/mesa/drivers/dri/radeon/radeon_common_context.c b/src/mesa/drivers/dri/radeon/radeon_common_context.c
2420 index 85e4988..d4c7864 100644
2421 --- a/src/mesa/drivers/dri/radeon/radeon_common_context.c
2422 +++ b/src/mesa/drivers/dri/radeon/radeon_common_context.c
2423 @@ -251,9 +251,9 @@ GLboolean radeonInitContext(radeonContextPtr radeon,
2424 radeon->texture_rect_row_align = 512;
2425 radeon->texture_compressed_row_align = 512;
2427 - radeon->texture_row_align = 256;
2428 - radeon->texture_rect_row_align = 256;
2429 - radeon->texture_compressed_row_align = 256;
2430 + radeon->texture_row_align = radeon->radeonScreen->group_bytes;
2431 + radeon->texture_rect_row_align = radeon->radeonScreen->group_bytes;
2432 + radeon->texture_compressed_row_align = radeon->radeonScreen->group_bytes;
2434 } else if (IS_R200_CLASS(radeon->radeonScreen) ||
2435 IS_R100_CLASS(radeon->radeonScreen)) {
2436 @@ -521,6 +521,7 @@ void radeon_prepare_render(radeonContextPtr radeon)
2437 __DRIcontext *driContext = radeon->dri.context;
2438 __DRIdrawable *drawable;
2439 __DRIscreen *screen;
2440 + struct radeon_framebuffer *draw;
2442 screen = driContext->driScreenPriv;
2443 if (!screen->dri2.loader)
2444 @@ -531,9 +532,10 @@ void radeon_prepare_render(radeonContextPtr radeon)
2445 if (drawable->lastStamp != drawable->dri2.stamp)
2446 radeon_update_renderbuffers(driContext, drawable, GL_FALSE);
2448 - /* Intel driver does the equivalent of this, no clue if it is needed:
2449 - * radeon_draw_buffer(radeon->glCtx, &(drawable->driverPrivate)->base);
2451 + /* Intel driver does the equivalent of this, no clue if it is needed:*/
2452 + draw = drawable->driverPrivate;
2453 + radeon_draw_buffer(radeon->glCtx, &draw->base);
2455 driContext->dri2.draw_stamp = drawable->dri2.stamp;
2458 @@ -738,10 +740,9 @@ radeon_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable,
2463 fprintf(stderr, "failed to attach %s %d\n",
2464 regname, buffers[i].name);
2469 ret = radeon_bo_get_tiling(bo, &tiling_flags, &pitch);
2470 diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c
2471 index 2ea77e5..0ca052d 100644
2472 --- a/src/mesa/drivers/dri/radeon/radeon_screen.c
2473 +++ b/src/mesa/drivers/dri/radeon/radeon_screen.c
2474 @@ -1138,6 +1138,8 @@ radeonCreateScreen( __DRIscreen *sPriv )
2476 screen->chip_flags |= RADEON_CLASS_R600;
2478 + /* set group bytes for r6xx+ */
2479 + screen->group_bytes = 256;
2480 screen->cpp = dri_priv->bpp / 8;
2481 screen->AGPMode = dri_priv->AGPMode;
2483 @@ -1382,7 +1384,8 @@ radeonCreateScreen2(__DRIscreen *sPriv)
2485 screen->chip_flags |= RADEON_CLASS_R600;
2487 - /* r6xx+ tiling */
2488 + /* r6xx+ tiling, default to 256 group bytes */
2489 + screen->group_bytes = 256;
2490 if (IS_R600_CLASS(screen) && (sPriv->drm_version.minor >= 6)) {
2491 ret = radeonGetParam(sPriv, RADEON_INFO_TILE_CONFIG, &temp);
2493 diff --git a/src/mesa/drivers/dri/radeon/radeon_swtcl.c b/src/mesa/drivers/dri/radeon/radeon_swtcl.c
2494 index 29defe7..0a81843 100644
2495 --- a/src/mesa/drivers/dri/radeon/radeon_swtcl.c
2496 +++ b/src/mesa/drivers/dri/radeon/radeon_swtcl.c
2497 @@ -412,6 +412,8 @@ static GLboolean radeon_run_render( GLcontext *ctx,
2500 radeon_prepare_render(&rmesa->radeon);
2501 + if (rmesa->radeon.NewGLState)
2502 + radeonValidateState( ctx );
2504 tnl->Driver.Render.Start( ctx );
2506 diff --git a/src/mesa/drivers/dri/radeon/radeon_tcl.c b/src/mesa/drivers/dri/radeon/radeon_tcl.c
2507 index 5e1718f..ded3ebe 100644
2508 --- a/src/mesa/drivers/dri/radeon/radeon_tcl.c
2509 +++ b/src/mesa/drivers/dri/radeon/radeon_tcl.c
2510 @@ -253,6 +253,8 @@ void radeonTclPrimitive( GLcontext *ctx,
2511 GLuint newprim = hw_prim | RADEON_CP_VC_CNTL_TCL_ENABLE;
2513 radeon_prepare_render(&rmesa->radeon);
2514 + if (rmesa->radeon.NewGLState)
2515 + radeonValidateState( ctx );
2517 if (newprim != rmesa->tcl.hw_primitive ||
2518 !discrete_prim[hw_prim&0xf]) {
2519 diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
2520 index 4797f29..d9eaada 100644
2521 --- a/src/mesa/main/bufferobj.c
2522 +++ b/src/mesa/main/bufferobj.c
2527 + * Used as a placeholder for buffer objects between glGenBuffers() and
2528 + * glBindBuffer() so that glIsBuffer() can work correctly.
2530 +static struct gl_buffer_object DummyBufferObject;
2534 * Return pointer to address of a buffer object target.
2535 * \param ctx the GL context
2536 * \param target the buffer object target to be retrieved.
2537 @@ -554,6 +561,9 @@ _mesa_copy_buffer_subdata(GLcontext *ctx,
2539 _mesa_init_buffer_objects( GLcontext *ctx )
2541 + memset(&DummyBufferObject, 0, sizeof(DummyBufferObject));
2542 + DummyBufferObject.RefCount = 1000*1000*1000; /* never delete */
2544 _mesa_reference_buffer_object(ctx, &ctx->Array.ArrayBufferObj,
2545 ctx->Shared->NullBufferObj);
2546 _mesa_reference_buffer_object(ctx, &ctx->Array.ElementArrayBufferObj,
2547 @@ -611,8 +621,10 @@ bind_buffer_object(GLcontext *ctx, GLenum target, GLuint buffer)
2549 /* non-default buffer object */
2550 newBufObj = _mesa_lookup_bufferobj(ctx, buffer);
2552 - /* if this is a new buffer object id, allocate a buffer object now */
2553 + if (!newBufObj || newBufObj == &DummyBufferObject) {
2554 + /* If this is a new buffer object id, or one which was generated but
2555 + * never used before, allocate a buffer object now.
2557 ASSERT(ctx->Driver.NewBufferObject);
2558 newBufObj = ctx->Driver.NewBufferObject(ctx, buffer, target);
2560 @@ -992,7 +1004,7 @@ _mesa_DeleteBuffersARB(GLsizei n, const GLuint *ids)
2561 struct gl_array_object *arrayObj = ctx->Array.ArrayObj;
2564 - ASSERT(bufObj->Name == ids[i]);
2565 + ASSERT(bufObj->Name == ids[i] || bufObj == &DummyBufferObject);
2567 if (_mesa_bufferobj_mapped(bufObj)) {
2568 /* if mapped, unmap it now */
2569 @@ -1033,7 +1045,7 @@ _mesa_DeleteBuffersARB(GLsizei n, const GLuint *ids)
2572 /* The ID is immediately freed for re-use */
2573 - _mesa_HashRemove(ctx->Shared->BufferObjects, bufObj->Name);
2574 + _mesa_HashRemove(ctx->Shared->BufferObjects, ids[i]);
2575 _mesa_reference_buffer_object(ctx, &bufObj, NULL);
2578 @@ -1072,18 +1084,10 @@ _mesa_GenBuffersARB(GLsizei n, GLuint *buffer)
2580 first = _mesa_HashFindFreeKeyBlock(ctx->Shared->BufferObjects, n);
2582 - /* Allocate new, empty buffer objects and return identifiers */
2583 + /* Insert the ID and pointer to dummy buffer object into hash table */
2584 for (i = 0; i < n; i++) {
2585 - struct gl_buffer_object *bufObj;
2586 - GLuint name = first + i;
2587 - GLenum target = 0;
2588 - bufObj = ctx->Driver.NewBufferObject( ctx, name, target );
2590 - _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex);
2591 - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glGenBuffersARB");
2594 - _mesa_HashInsert(ctx->Shared->BufferObjects, first + i, bufObj);
2595 + _mesa_HashInsert(ctx->Shared->BufferObjects, first + i,
2596 + &DummyBufferObject);
2597 buffer[i] = first + i;
2600 @@ -1109,7 +1113,7 @@ _mesa_IsBufferARB(GLuint id)
2601 bufObj = _mesa_lookup_bufferobj(ctx, id);
2602 _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex);
2604 - return bufObj ? GL_TRUE : GL_FALSE;
2605 + return bufObj && bufObj != &DummyBufferObject;
2609 diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c
2610 index 9db9f1c..c3fe8a3 100644
2611 --- a/src/mesa/main/formats.c
2612 +++ b/src/mesa/main/formats.c
2613 @@ -1109,6 +1109,7 @@ _mesa_format_to_type_and_comps(gl_format format,
2614 case MESA_FORMAT_ARGB8888:
2615 case MESA_FORMAT_ARGB8888_REV:
2616 case MESA_FORMAT_XRGB8888:
2617 + case MESA_FORMAT_XRGB8888_REV:
2618 *datatype = GL_UNSIGNED_BYTE;
2621 @@ -1135,6 +1136,11 @@ _mesa_format_to_type_and_comps(gl_format format,
2625 + case MESA_FORMAT_RGBA5551:
2626 + *datatype = GL_UNSIGNED_SHORT_5_5_5_1;
2630 case MESA_FORMAT_AL88:
2631 case MESA_FORMAT_AL88_REV:
2632 *datatype = GL_UNSIGNED_BYTE;
2633 @@ -1156,6 +1162,7 @@ _mesa_format_to_type_and_comps(gl_format format,
2634 case MESA_FORMAT_L8:
2635 case MESA_FORMAT_I8:
2636 case MESA_FORMAT_CI8:
2637 + case MESA_FORMAT_S8:
2638 *datatype = GL_UNSIGNED_BYTE;
2641 @@ -1201,12 +1208,26 @@ _mesa_format_to_type_and_comps(gl_format format,
2645 + case MESA_FORMAT_SIGNED_R8:
2646 + *datatype = GL_BYTE;
2649 + case MESA_FORMAT_SIGNED_RG88:
2650 + *datatype = GL_BYTE;
2653 case MESA_FORMAT_SIGNED_RGBA8888:
2654 case MESA_FORMAT_SIGNED_RGBA8888_REV:
2655 + case MESA_FORMAT_SIGNED_RGBX8888:
2656 *datatype = GL_BYTE;
2660 + case MESA_FORMAT_RGBA_16:
2661 + *datatype = GL_UNSIGNED_SHORT;
2665 case MESA_FORMAT_SIGNED_R_16:
2666 *datatype = GL_SHORT;
2668 @@ -1331,9 +1352,14 @@ _mesa_format_to_type_and_comps(gl_format format,
2673 + case MESA_FORMAT_NONE:
2674 + case MESA_FORMAT_COUNT:
2675 + /* For debug builds, warn if any formats are not handled */
2678 - _mesa_problem(NULL, "bad format in _mesa_format_to_type_and_comps");
2680 + _mesa_problem(NULL, "bad format %s in _mesa_format_to_type_and_comps",
2681 + _mesa_get_format_name(format));
2685 diff --git a/src/mesa/main/imports.c b/src/mesa/main/imports.c
2686 index 46e5c93..13dabde 100644
2687 --- a/src/mesa/main/imports.c
2688 +++ b/src/mesa/main/imports.c
2689 @@ -88,7 +88,8 @@ _mesa_align_malloc(size_t bytes, unsigned long alignment)
2690 #if defined(HAVE_POSIX_MEMALIGN)
2692 int err = posix_memalign(& mem, alignment, bytes);
2697 #elif defined(_WIN32) && defined(_MSC_VER)
2698 return _aligned_malloc(bytes, alignment);
2699 diff --git a/src/mesa/main/mipmap.c b/src/mesa/main/mipmap.c
2700 index 3d1a4c4..71aa8c2 100644
2701 --- a/src/mesa/main/mipmap.c
2702 +++ b/src/mesa/main/mipmap.c
2703 @@ -288,6 +288,54 @@ do_row(GLenum datatype, GLuint comps, GLint srcWidth,
2704 dst[i] = (rowA[j] + rowA[k] + rowB[j] + rowB[k]) / 4;
2708 + else if (datatype == GL_SHORT && comps == 4) {
2710 + const GLshort(*rowA)[4] = (const GLshort(*)[4]) srcRowA;
2711 + const GLshort(*rowB)[4] = (const GLshort(*)[4]) srcRowB;
2712 + GLshort(*dst)[4] = (GLshort(*)[4]) dstRow;
2713 + for (i = j = 0, k = k0; i < (GLuint) dstWidth;
2714 + i++, j += colStride, k += colStride) {
2715 + dst[i][0] = (rowA[j][0] + rowA[k][0] + rowB[j][0] + rowB[k][0]) / 4;
2716 + dst[i][1] = (rowA[j][1] + rowA[k][1] + rowB[j][1] + rowB[k][1]) / 4;
2717 + dst[i][2] = (rowA[j][2] + rowA[k][2] + rowB[j][2] + rowB[k][2]) / 4;
2718 + dst[i][3] = (rowA[j][3] + rowA[k][3] + rowB[j][3] + rowB[k][3]) / 4;
2721 + else if (datatype == GL_SHORT && comps == 3) {
2723 + const GLshort(*rowA)[3] = (const GLshort(*)[3]) srcRowA;
2724 + const GLshort(*rowB)[3] = (const GLshort(*)[3]) srcRowB;
2725 + GLshort(*dst)[3] = (GLshort(*)[3]) dstRow;
2726 + for (i = j = 0, k = k0; i < (GLuint) dstWidth;
2727 + i++, j += colStride, k += colStride) {
2728 + dst[i][0] = (rowA[j][0] + rowA[k][0] + rowB[j][0] + rowB[k][0]) / 4;
2729 + dst[i][1] = (rowA[j][1] + rowA[k][1] + rowB[j][1] + rowB[k][1]) / 4;
2730 + dst[i][2] = (rowA[j][2] + rowA[k][2] + rowB[j][2] + rowB[k][2]) / 4;
2733 + else if (datatype == GL_SHORT && comps == 2) {
2735 + const GLshort(*rowA)[2] = (const GLshort(*)[2]) srcRowA;
2736 + const GLshort(*rowB)[2] = (const GLshort(*)[2]) srcRowB;
2737 + GLshort(*dst)[2] = (GLshort(*)[2]) dstRow;
2738 + for (i = j = 0, k = k0; i < (GLuint) dstWidth;
2739 + i++, j += colStride, k += colStride) {
2740 + dst[i][0] = (rowA[j][0] + rowA[k][0] + rowB[j][0] + rowB[k][0]) / 4;
2741 + dst[i][1] = (rowA[j][1] + rowA[k][1] + rowB[j][1] + rowB[k][1]) / 4;
2744 + else if (datatype == GL_SHORT && comps == 1) {
2746 + const GLshort *rowA = (const GLshort *) srcRowA;
2747 + const GLshort *rowB = (const GLshort *) srcRowB;
2748 + GLshort *dst = (GLshort *) dstRow;
2749 + for (i = j = 0, k = k0; i < (GLuint) dstWidth;
2750 + i++, j += colStride, k += colStride) {
2751 + dst[i] = (rowA[j] + rowA[k] + rowB[j] + rowB[k]) / 4;
2755 else if (datatype == GL_FLOAT && comps == 4) {
2757 const GLfloat(*rowA)[4] = (const GLfloat(*)[4]) srcRowA;
2758 @@ -507,6 +555,37 @@ do_row(GLenum datatype, GLuint comps, GLint srcWidth,
2759 dst[i] = (alpha << 15) | (blue << 10) | (green << 5) | red;
2762 + else if (datatype == GL_UNSIGNED_SHORT_5_5_5_1 && comps == 4) {
2764 + const GLushort *rowA = (const GLushort *) srcRowA;
2765 + const GLushort *rowB = (const GLushort *) srcRowB;
2766 + GLushort *dst = (GLushort *) dstRow;
2767 + for (i = j = 0, k = k0; i < (GLuint) dstWidth;
2768 + i++, j += colStride, k += colStride) {
2769 + const GLint rowAr0 = (rowA[j] >> 11) & 0x1f;
2770 + const GLint rowAr1 = (rowA[k] >> 11) & 0x1f;
2771 + const GLint rowBr0 = (rowB[j] >> 11) & 0x1f;
2772 + const GLint rowBr1 = (rowB[k] >> 11) & 0x1f;
2773 + const GLint rowAg0 = (rowA[j] >> 6) & 0x1f;
2774 + const GLint rowAg1 = (rowA[k] >> 6) & 0x1f;
2775 + const GLint rowBg0 = (rowB[j] >> 6) & 0x1f;
2776 + const GLint rowBg1 = (rowB[k] >> 6) & 0x1f;
2777 + const GLint rowAb0 = (rowA[j] >> 1) & 0x1f;
2778 + const GLint rowAb1 = (rowA[k] >> 1) & 0x1f;
2779 + const GLint rowBb0 = (rowB[j] >> 1) & 0x1f;
2780 + const GLint rowBb1 = (rowB[k] >> 1) & 0x1f;
2781 + const GLint rowAa0 = (rowA[j] & 0x1);
2782 + const GLint rowAa1 = (rowA[k] & 0x1);
2783 + const GLint rowBa0 = (rowB[j] & 0x1);
2784 + const GLint rowBa1 = (rowB[k] & 0x1);
2785 + const GLint red = (rowAr0 + rowAr1 + rowBr0 + rowBr1) >> 2;
2786 + const GLint green = (rowAg0 + rowAg1 + rowBg0 + rowBg1) >> 2;
2787 + const GLint blue = (rowAb0 + rowAb1 + rowBb0 + rowBb1) >> 2;
2788 + const GLint alpha = (rowAa0 + rowAa1 + rowBa0 + rowBa1) >> 2;
2789 + dst[i] = (red << 11) | (green << 6) | (blue << 1) | alpha;
2793 else if (datatype == GL_UNSIGNED_BYTE_3_3_2 && comps == 3) {
2795 const GLubyte *rowA = (const GLubyte *) srcRowA;
2796 @@ -606,7 +685,7 @@ do_row_3D(GLenum datatype, GLuint comps, GLint srcWidth,
2800 - if ((datatype == GL_BYTE) && (comps == 4)) {
2801 + else if ((datatype == GL_BYTE) && (comps == 4)) {
2802 DECLARE_ROW_POINTERS(GLbyte, 4);
2804 for (i = j = 0, k = k0; i < (GLuint) dstWidth;
2805 @@ -682,6 +761,44 @@ do_row_3D(GLenum datatype, GLuint comps, GLint srcWidth,
2809 + else if ((datatype == GL_SHORT) && (comps == 4)) {
2810 + DECLARE_ROW_POINTERS(GLshort, 4);
2812 + for (i = j = 0, k = k0; i < (GLuint) dstWidth;
2813 + i++, j += colStride, k += colStride) {
2820 + else if ((datatype == GL_SHORT) && (comps == 3)) {
2821 + DECLARE_ROW_POINTERS(GLshort, 3);
2823 + for (i = j = 0, k = k0; i < (GLuint) dstWidth;
2824 + i++, j += colStride, k += colStride) {
2830 + else if ((datatype == GL_SHORT) && (comps == 2)) {
2831 + DECLARE_ROW_POINTERS(GLshort, 2);
2833 + for (i = j = 0, k = k0; i < (GLuint) dstWidth;
2834 + i++, j += colStride, k += colStride) {
2839 + else if ((datatype == GL_SHORT) && (comps == 1)) {
2840 + DECLARE_ROW_POINTERS(GLshort, 1);
2842 + for (i = j = 0, k = k0; i < (GLuint) dstWidth;
2843 + i++, j += colStride, k += colStride) {
2847 else if ((datatype == GL_FLOAT) && (comps == 4)) {
2848 DECLARE_ROW_POINTERS(GLfloat, 4);
2850 @@ -910,6 +1027,55 @@ do_row_3D(GLenum datatype, GLuint comps, GLint srcWidth,
2851 dst[i] = (a << 15) | (b << 10) | (g << 5) | r;
2854 + else if ((datatype == GL_UNSIGNED_SHORT_5_5_5_1) && (comps == 4)) {
2855 + DECLARE_ROW_POINTERS0(GLushort);
2857 + for (i = j = 0, k = k0; i < (GLuint) dstWidth;
2858 + i++, j += colStride, k += colStride) {
2859 + const GLint rowAr0 = (rowA[j] >> 11) & 0x1f;
2860 + const GLint rowAr1 = (rowA[k] >> 11) & 0x1f;
2861 + const GLint rowBr0 = (rowB[j] >> 11) & 0x1f;
2862 + const GLint rowBr1 = (rowB[k] >> 11) & 0x1f;
2863 + const GLint rowCr0 = (rowC[j] >> 11) & 0x1f;
2864 + const GLint rowCr1 = (rowC[k] >> 11) & 0x1f;
2865 + const GLint rowDr0 = (rowD[j] >> 11) & 0x1f;
2866 + const GLint rowDr1 = (rowD[k] >> 11) & 0x1f;
2867 + const GLint rowAg0 = (rowA[j] >> 6) & 0x1f;
2868 + const GLint rowAg1 = (rowA[k] >> 6) & 0x1f;
2869 + const GLint rowBg0 = (rowB[j] >> 6) & 0x1f;
2870 + const GLint rowBg1 = (rowB[k] >> 6) & 0x1f;
2871 + const GLint rowCg0 = (rowC[j] >> 6) & 0x1f;
2872 + const GLint rowCg1 = (rowC[k] >> 6) & 0x1f;
2873 + const GLint rowDg0 = (rowD[j] >> 6) & 0x1f;
2874 + const GLint rowDg1 = (rowD[k] >> 6) & 0x1f;
2875 + const GLint rowAb0 = (rowA[j] >> 1) & 0x1f;
2876 + const GLint rowAb1 = (rowA[k] >> 1) & 0x1f;
2877 + const GLint rowBb0 = (rowB[j] >> 1) & 0x1f;
2878 + const GLint rowBb1 = (rowB[k] >> 1) & 0x1f;
2879 + const GLint rowCb0 = (rowC[j] >> 1) & 0x1f;
2880 + const GLint rowCb1 = (rowC[k] >> 1) & 0x1f;
2881 + const GLint rowDb0 = (rowD[j] >> 1) & 0x1f;
2882 + const GLint rowDb1 = (rowD[k] >> 1) & 0x1f;
2883 + const GLint rowAa0 = (rowA[j] & 0x1);
2884 + const GLint rowAa1 = (rowA[k] & 0x1);
2885 + const GLint rowBa0 = (rowB[j] & 0x1);
2886 + const GLint rowBa1 = (rowB[k] & 0x1);
2887 + const GLint rowCa0 = (rowC[j] & 0x1);
2888 + const GLint rowCa1 = (rowC[k] & 0x1);
2889 + const GLint rowDa0 = (rowD[j] & 0x1);
2890 + const GLint rowDa1 = (rowD[k] & 0x1);
2891 + const GLint r = FILTER_SUM_3D(rowAr0, rowAr1, rowBr0, rowBr1,
2892 + rowCr0, rowCr1, rowDr0, rowDr1);
2893 + const GLint g = FILTER_SUM_3D(rowAg0, rowAg1, rowBg0, rowBg1,
2894 + rowCg0, rowCg1, rowDg0, rowDg1);
2895 + const GLint b = FILTER_SUM_3D(rowAb0, rowAb1, rowBb0, rowBb1,
2896 + rowCb0, rowCb1, rowDb0, rowDb1);
2897 + const GLint a = FILTER_SUM_3D(rowAa0, rowAa1, rowBa0, rowBa1,
2898 + rowCa0, rowCa1, rowDa0, rowDa1);
2900 + dst[i] = (r << 11) | (g << 6) | (b << 1) | a;
2903 else if ((datatype == GL_UNSIGNED_BYTE_3_3_2) && (comps == 3)) {
2904 DECLARE_ROW_POINTERS0(GLushort);
2906 diff --git a/src/mesa/program/prog_statevars.c b/src/mesa/program/prog_statevars.c
2907 index 2687f8a..778447d 100644
2908 --- a/src/mesa/program/prog_statevars.c
2909 +++ b/src/mesa/program/prog_statevars.c
2910 @@ -584,6 +584,24 @@ _mesa_fetch_state(GLcontext *ctx, const gl_state_index state[],
2914 + case STATE_FB_WPOS_Y_TRANSFORM:
2915 + /* A driver may negate this conditional by using ZW swizzle
2916 + * instead of XY (based on e.g. some other state). */
2917 + if (ctx->DrawBuffer->Name != 0) {
2918 + /* Identity (XY) followed by flipping Y upside down (ZW). */
2922 + value[3] = (GLfloat) (ctx->DrawBuffer->Height - 1);
2924 + /* Flipping Y upside down (XY) followed by identity (ZW). */
2926 + value[1] = (GLfloat) (ctx->DrawBuffer->Height - 1);
2932 case STATE_ROT_MATRIX_0:
2934 const int unit = (int) state[2];
2935 @@ -711,6 +729,7 @@ _mesa_program_state_flags(const gl_state_index state[STATE_LENGTH])
2939 + case STATE_FB_WPOS_Y_TRANSFORM:
2940 return _NEW_BUFFERS;
2943 @@ -925,6 +944,9 @@ append_token(char *dst, gl_state_index k)
2945 append(dst, "FbSize");
2947 + case STATE_FB_WPOS_Y_TRANSFORM:
2948 + append(dst, "FbWposYTransform");
2950 case STATE_ROT_MATRIX_0:
2951 append(dst, "rotMatrixRow0");
2953 diff --git a/src/mesa/program/prog_statevars.h b/src/mesa/program/prog_statevars.h
2954 index 1753471..82712c5 100644
2955 --- a/src/mesa/program/prog_statevars.h
2956 +++ b/src/mesa/program/prog_statevars.h
2957 @@ -120,6 +120,7 @@ typedef enum gl_state_index_ {
2958 STATE_PCM_BIAS, /**< Post color matrix RGBA bias */
2959 STATE_SHADOW_AMBIENT, /**< ARB_shadow_ambient fail value; token[2] is texture unit index */
2960 STATE_FB_SIZE, /**< (width-1, height-1, 0, 0) */
2961 + STATE_FB_WPOS_Y_TRANSFORM, /**< (1, 0, -1, height-1) if a FBO is bound, (-1, height-1, 1, 0) otherwise */
2962 STATE_ROT_MATRIX_0, /**< ATI_envmap_bumpmap, rot matrix row 0 */
2963 STATE_ROT_MATRIX_1, /**< ATI_envmap_bumpmap, rot matrix row 1 */
2964 STATE_INTERNAL_DRIVER /* first available state index for drivers (must be last) */
2965 diff --git a/src/mesa/state_tracker/st_cb_bufferobjects.c b/src/mesa/state_tracker/st_cb_bufferobjects.c
2966 index 7991a93..50b352c 100644
2967 --- a/src/mesa/state_tracker/st_cb_bufferobjects.c
2968 +++ b/src/mesa/state_tracker/st_cb_bufferobjects.c
2969 @@ -211,6 +211,13 @@ st_bufferobj_data(GLcontext *ctx,
2973 + * Dummy data whose's pointer is used for zero size buffers or ranges.
2975 +static long st_bufferobj_zero_length = 0;
2980 * Called via glMapBufferARB().
2983 @@ -233,10 +240,16 @@ st_bufferobj_map(GLcontext *ctx, GLenum target, GLenum access,
2987 - obj->Pointer = pipe_buffer_map(st_context(ctx)->pipe,
2990 - &st_obj->transfer);
2991 + /* Handle zero-size buffers here rather than in drivers */
2992 + if (obj->Size == 0) {
2993 + obj->Pointer = &st_bufferobj_zero_length;
2996 + obj->Pointer = pipe_buffer_map(st_context(ctx)->pipe,
2999 + &st_obj->transfer);
3004 @@ -247,13 +260,6 @@ st_bufferobj_map(GLcontext *ctx, GLenum target, GLenum access,
3008 - * Dummy data whose's pointer is used for zero length ranges.
3011 -st_bufferobj_zero_length_range = 0;
3015 * Called via glMapBufferRange().
3018 @@ -293,7 +299,7 @@ st_bufferobj_map_range(GLcontext *ctx, GLenum target,
3019 * length range from the pipe driver.
3022 - obj->Pointer = &st_bufferobj_zero_length_range;
3023 + obj->Pointer = &st_bufferobj_zero_length;
3026 obj->Pointer = pipe_buffer_map_range(pipe,
3027 diff --git a/src/mesa/state_tracker/st_cb_eglimage.c b/src/mesa/state_tracker/st_cb_eglimage.c
3028 index 3145416..c54baf4 100644
3029 --- a/src/mesa/state_tracker/st_cb_eglimage.c
3030 +++ b/src/mesa/state_tracker/st_cb_eglimage.c
3031 @@ -129,6 +129,7 @@ st_bind_surface(GLcontext *ctx, GLenum target,
3033 /* FIXME create a non-default sampler view from the pipe_surface? */
3034 pipe_resource_reference(&stObj->pt, ps->texture);
3035 + pipe_sampler_view_reference(&stObj->sampler_view, NULL);
3036 pipe_resource_reference(&stImage->pt, stObj->pt);
3038 stObj->width0 = ps->width;
3039 diff --git a/src/mesa/state_tracker/st_manager.c b/src/mesa/state_tracker/st_manager.c
3040 index 66e32b4..cd418a0 100644
3041 --- a/src/mesa/state_tracker/st_manager.c
3042 +++ b/src/mesa/state_tracker/st_manager.c
3043 @@ -486,9 +486,18 @@ st_context_notify_invalid_framebuffer(struct st_context_iface *stctxi,
3044 stfb = st_ws_framebuffer(st->ctx->WinSysDrawBuffer);
3045 if (!stfb || stfb->iface != stfbi)
3046 stfb = st_ws_framebuffer(st->ctx->WinSysReadBuffer);
3047 - assert(stfb && stfb->iface == stfbi);
3049 - p_atomic_set(&stfb->revalidate, TRUE);
3050 + if (stfb && stfb->iface == stfbi) {
3051 + p_atomic_set(&stfb->revalidate, TRUE);
3054 + /* This function is probably getting called when we've detected a
3055 + * change in a window's size but the currently bound context is
3056 + * not bound to that window.
3057 + * If the st_framebuffer_iface structure had a pointer to the
3058 + * corresponding st_framebuffer we'd be able to handle this.
3064 diff --git a/src/mesa/state_tracker/st_mesa_to_tgsi.c b/src/mesa/state_tracker/st_mesa_to_tgsi.c
3065 index 0ed822b..2712717 100644
3066 --- a/src/mesa/state_tracker/st_mesa_to_tgsi.c
3067 +++ b/src/mesa/state_tracker/st_mesa_to_tgsi.c
3068 @@ -760,10 +760,13 @@ emit_adjusted_wpos( struct st_translate *t,
3071 * Emit the TGSI instructions for inverting the WPOS y coordinate.
3072 + * This code is unavoidable because it also depends on whether
3073 + * a FBO is bound (STATE_FB_WPOS_Y_TRANSFORM).
3076 -emit_inverted_wpos( struct st_translate *t,
3077 - const struct gl_program *program )
3078 +emit_wpos_inversion( struct st_translate *t,
3079 + const struct gl_program *program,
3082 struct ureg_program *ureg = t->ureg;
3084 @@ -771,17 +774,17 @@ emit_inverted_wpos( struct st_translate *t,
3085 * Need to replace instances of INPUT[WPOS] with temp T
3086 * where T = INPUT[WPOS] by y is inverted.
3088 - static const gl_state_index winSizeState[STATE_LENGTH]
3089 - = { STATE_INTERNAL, STATE_FB_SIZE, 0, 0, 0 };
3090 + static const gl_state_index wposTransformState[STATE_LENGTH]
3091 + = { STATE_INTERNAL, STATE_FB_WPOS_Y_TRANSFORM, 0, 0, 0 };
3093 /* XXX: note we are modifying the incoming shader here! Need to
3094 * do this before emitting the constant decls below, or this
3097 - unsigned winHeightConst = _mesa_add_state_reference(program->Parameters,
3099 + unsigned wposTransConst = _mesa_add_state_reference(program->Parameters,
3100 + wposTransformState);
3102 - struct ureg_src winsize = ureg_DECL_constant( ureg, winHeightConst );
3103 + struct ureg_src wpostrans = ureg_DECL_constant( ureg, wposTransConst );
3104 struct ureg_dst wpos_temp;
3105 struct ureg_src wpos_input = t->inputs[t->inputMapping[FRAG_ATTRIB_WPOS]];
3107 @@ -794,12 +797,23 @@ emit_inverted_wpos( struct st_translate *t,
3108 ureg_MOV( ureg, wpos_temp, wpos_input );
3111 - /* SUB wpos_temp.y, winsize_const, wpos_input
3114 - ureg_writemask(wpos_temp, TGSI_WRITEMASK_Y ),
3118 + /* MAD wpos_temp.y, wpos_input, wpostrans.xxxx, wpostrans.yyyy
3121 + ureg_writemask(wpos_temp, TGSI_WRITEMASK_Y ),
3123 + ureg_scalar(wpostrans, 0),
3124 + ureg_scalar(wpostrans, 1));
3126 + /* MAD wpos_temp.y, wpos_input, wpostrans.zzzz, wpostrans.wwww
3129 + ureg_writemask(wpos_temp, TGSI_WRITEMASK_Y ),
3131 + ureg_scalar(wpostrans, 2),
3132 + ureg_scalar(wpostrans, 3));
3135 /* Use wpos_temp as position input from here on:
3137 @@ -861,8 +875,7 @@ emit_wpos(struct st_context *st,
3139 /* we invert after adjustment so that we avoid the MOV to temporary,
3140 * and reuse the adjustment ADD instead */
3142 - emit_inverted_wpos(t, program);
3143 + emit_wpos_inversion(t, program, invert);
3147 diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c
3148 index 8c2d8b6..63faa4a 100644
3149 --- a/src/mesa/state_tracker/st_program.c
3150 +++ b/src/mesa/state_tracker/st_program.c
3151 @@ -216,6 +216,8 @@ st_translate_vertex_program(struct st_context *st,
3157 vpv->num_inputs = stvp->num_inputs;
3158 num_outputs = stvp->num_outputs;
3159 if (key->passthrough_edgeflags) {
3160 diff --git a/src/mesa/swrast/s_texfilter.c b/src/mesa/swrast/s_texfilter.c
3161 index 3fc554c..28063e0 100644
3162 --- a/src/mesa/swrast/s_texfilter.c
3163 +++ b/src/mesa/swrast/s_texfilter.c
3164 @@ -1368,6 +1368,7 @@ opt_sample_rgb_2d(GLcontext *ctx,
3165 rgba[k][RCOMP] = UBYTE_TO_FLOAT(texel[2]);
3166 rgba[k][GCOMP] = UBYTE_TO_FLOAT(texel[1]);
3167 rgba[k][BCOMP] = UBYTE_TO_FLOAT(texel[0]);
3168 + rgba[k][ACOMP] = 1.0F;
3172 @@ -2972,11 +2973,16 @@ choose_depth_texture_level(const struct gl_texture_object *tObj, GLfloat lambda)
3176 - lambda = CLAMP(lambda, tObj->MinLod, tObj->MaxLod);
3178 - level = (GLint) lambda;
3180 - level = CLAMP(level, tObj->BaseLevel, tObj->_MaxLevel);
3181 + if (tObj->MinFilter == GL_NEAREST || tObj->MinFilter == GL_LINEAR) {
3182 + /* no mipmapping - use base level */
3183 + level = tObj->BaseLevel;
3186 + /* choose mipmap level */
3187 + lambda = CLAMP(lambda, tObj->MinLod, tObj->MaxLod);
3188 + level = (GLint) lambda;
3189 + level = CLAMP(level, tObj->BaseLevel, tObj->_MaxLevel);