]> git.pld-linux.org Git - packages/Mesa.git/blame - Mesa-git.patch
- rel 5; git fixes update
[packages/Mesa.git] / Mesa-git.patch
CommitLineData
c3c893c6
AM
1diff --git a/Makefile b/Makefile
2index b8069f9..b13ed33 100644
3--- a/Makefile
4+++ b/Makefile
5@@ -347,23 +347,19 @@ GALLIUM_FILES = \
6
7 DRI_FILES = \
8 $(DIRECTORY)/include/GL/internal/dri_interface.h \
9- $(DIRECTORY)/include/GL/internal/glcore.h \
10 $(DIRECTORY)/include/GL/internal/sarea.h \
11 $(DIRECTORY)/src/glx/Makefile \
12- $(DIRECTORY)/src/glx/Makefile \
13 $(DIRECTORY)/src/glx/*.[ch] \
14 $(DIRECTORY)/src/mesa/drivers/dri/Makefile \
15 $(DIRECTORY)/src/mesa/drivers/dri/Makefile.template \
16 $(DIRECTORY)/src/mesa/drivers/dri/dri.pc.in \
17- $(DIRECTORY)/src/mesa/drivers/dri/common/xmlpool/*.[ch] \
18 $(DIRECTORY)/src/mesa/drivers/dri/common/xmlpool/*.po \
19 $(DIRECTORY)/src/mesa/drivers/dri/*/*.[chS] \
20 $(DIRECTORY)/src/mesa/drivers/dri/*/*.cpp \
21 $(DIRECTORY)/src/mesa/drivers/dri/*/*/*.[chS] \
22 $(DIRECTORY)/src/mesa/drivers/dri/*/Makefile \
23 $(DIRECTORY)/src/mesa/drivers/dri/*/*/Makefile \
24- $(DIRECTORY)/src/mesa/drivers/dri/*/Doxyfile \
25- $(DIRECTORY)/src/mesa/drivers/dri/*/server/*.[ch]
26+ $(DIRECTORY)/src/mesa/drivers/dri/*/Doxyfile
27
28 SGI_GLU_FILES = \
29 $(DIRECTORY)/src/glu/Makefile \
9caf779f
AM
30diff --git a/docs/devinfo.html b/docs/devinfo.html
31index df0e726..2d1c125 100644
32--- a/docs/devinfo.html
33+++ b/docs/devinfo.html
34@@ -145,7 +145,7 @@ Make sure the values in src/mesa/main/version.h are correct.
35 </p>
36
37 <p>
38-Update the docs/news.html file and docs/download.html files.
39+Update docs/news.html.
40 </p>
41
42 <p>
43@@ -208,10 +208,11 @@ sftp USERNAME,mesa3d@web.sourceforge.net
44
45 <p>
46 Make an announcement on the mailing lists:
47-<em>m</em><em>e</em><em>s</em><em>a</em><em>3</em><em>d</em><em>-</em><em>d</em><em>e</em><em>v</em><em>@</em><em>l</em><em>i</em><em>s</em><em>t</em><em>s</em><em>.</em><em>s</em><em>f</em><em>.</em><em>n</em><em>e</em><em>t</em>,
48-<em>m</em><em>e</em><em>s</em><em>a</em><em>3</em><em>d</em><em>-</em><em>u</em><em>s</em><em>e</em><em>r</em><em>s</em><em>@</em><em>l</em><em>i</em><em>s</em><em>t</em><em>s</em><em>.</em><em>s</em><em>f</em><em>.</em><em>n</em><em>e</em><em>t</em>
49+
50+<em>m</em><em>e</em><em>s</em><em>a</em><em>-</em><em>d</em><em>e</em><em>v</em><em>@</em><em>l</em><em>i</em><em>s</em><em>t</em><em>s</em><em>.</em><em>f</em><em>r</em><em>e</em><em>e</em><em>d</em><em>e</em><em>s</em><em>k</em><em>t</em><em>o</em><em>p</em><em>.</em><em>o</em><em>r</em><em>g</em>,
51+<em>m</em><em>e</em><em>s</em><em>a</em><em>-</em><em>u</em><em>s</em><em>e</em><em>r</em><em>s</em><em>@</em><em>l</em><em>i</em><em>s</em><em>t</em><em>s</em><em>.</em><em>f</em><em>r</em><em>e</em><em>e</em><em>d</em><em>e</em><em>s</em><em>k</em><em>t</em><em>o</em><em>p</em><em>.</em><em>o</em><em>r</em><em>g</em>
52 and
53-<em>m</em><em>e</em><em>s</em><em>a</em><em>3</em><em>d</em><em>-</em><em>a</em><em>n</em><em>n</em><em>o</em><em>u</em><em>n</em><em>c</em><em>e</em><em>@</em><em>l</em><em>i</em><em>s</em><em>t</em><em>s</em><em>.</em><em>s</em><em>f</em><em>.</em><em>n</em><em>e</em><em>t</em>
54+<em>m</em><em>e</em><em>s</em><em>a</em><em>-</em><em>a</em><em>n</em><em>n</em><em>o</em><em>u</em><em>n</em><em>c</em><em>e</em><em>@</em><em>l</em><em>i</em><em>s</em><em>t</em><em>s</em><em>.</em><em>f</em><em>r</em><em>e</em><em>e</em><em>d</em><em>e</em><em>s</em><em>k</em><em>t</em><em>o</em><em>p</em><em>.</em><em>o</em><em>r</em><em>g</em>
55 </p>
56
57
58diff --git a/docs/news.html b/docs/news.html
59index b3fb8b5..72d38ee 100644
60--- a/docs/news.html
61+++ b/docs/news.html
62@@ -11,10 +11,18 @@
63 <H1>News</H1>
64
65
66+<h2>October 4, 2010</h2>
67+
68+<p>
69+<a href="relnotes-7.9.html">Mesa 7.9</a> (final) is released. This is a new
70+development release.
71+</p>
72+
73+
74 <h2>September 27, 2010</h2>
75
76 <p>
77-<a href="relnotes-7.9.0.html">Mesa 7.9.0-rc1</a> is released. This is a
78+<a href="relnotes-7.9.html">Mesa 7.9.0-rc1</a> is released. This is a
79 release candidate for the 7.9 development release.
80 </p>
81
82diff --git a/docs/relnotes-7.8.2.html b/docs/relnotes-7.8.2.html
83index e1b0f2d..1393b2e 100644
84--- a/docs/relnotes-7.8.2.html
85+++ b/docs/relnotes-7.8.2.html
86@@ -26,7 +26,15 @@ for DRI hardware acceleration.
87
88 <h2>MD5 checksums</h2>
89 <pre>
90-tbd
91+c89b63d253605ed40e8ac370d25a833c MesaLib-7.8.2.tar.gz
92+6be2d343a0089bfd395ce02aaf8adb57 MesaLib-7.8.2.tar.bz2
93+a04ad3b06ac5ff3969a003fa7bbf7d5b MesaLib-7.8.2.zip
94+7c213f92efeb471f0331670d5079d4c0 MesaDemos-7.8.2.tar.gz
95+757d9e2e06f48b1a52848be9b0307ced MesaDemos-7.8.2.tar.bz2
96+8d0e5cfe68b8ebf90265d350ae2c48b1 MesaDemos-7.8.2.zip
97+b74482e3f44f35ed395c4aada4fd8240 MesaGLUT-7.8.2.tar.gz
98+a471807b65e49c325808ba4551be93ed MesaGLUT-7.8.2.tar.bz2
99+9f190268c42be582ef66e47365ee61e3 MesaGLUT-7.8.2.zip
100 </pre>
101
102
103@@ -44,10 +52,95 @@ tbd
104 <ul>
105 <li>Fixed Gallium glDrawPixels(GL_DEPTH_COMPONENT).
106 <li>Fixed Gallium Cell driver to buildable, runable state
107+<li>Fixed bad error checking for glFramebufferRenderbuffer(attachment=GL_DEPTH_STENCIL_ATTACHMENT).
108+<li>Fixed incorrect Z coordinate handling in "meta" glDraw/CopyPixels.
109+ <a href="https://bugs.freedesktop.org/show_bug.cgi?id=23670">Bug
110+ #23670</a>.</li>
111+
112+<li>Assorted i965 driver fixes.
113+ Including but not limited to:
114+ <ul>
115+ <li>Fix scissoring when width or height is
116+ 0. <a href="https://bugs.freedesktop.org/show_bug.cgi?id=27643">Bug
117+ #27643</a>.
118+ <li>Fix bit allocation for number of color regions for
119+ ARB_draw_buffers.</li>
120+ <li>Set the correct provoking vertex for clipped first-mode
121+ trifans. <a href="https://bugs.freedesktop.org/show_bug.cgi?id=24470">Bug
122+ #24470</a>.</li>
123+ <li>Use <code>R16G16B16A16_FLOAT</code> for 3-component half-float.</li>
124+ <li>Fix assertion for surface tile offset usage on Ironlake.</li>
125+ <li>Fix cube map layouts on Ironlake.</li>
126+ <li>When an RB gets a new region, clear the old from the state
127+ cache. <a href="https://bugs.freedesktop.org/show_bug.cgi?id=24119">Bug
128+ #24119</a>.</li>
129+ <li>Reject shaders with uninlined function calls instead of hanging.</li>
130+ </ul>
131+</li>
132+
133+<li>Assorted i915 driver fixes. Including but not limited to:
134+ <ul>
135+ <li>Fixed texture LOD clamping in i915 driver.
136+ <a href="https://bugs.freedesktop.org/show_bug.cgi?id=24846">Bug
137+ #24846</a>.</li>
138+ <li>Fix off-by-one for drawing rectangle.
139+ <a href="https://bugs.freedesktop.org/show_bug.cgi?id=27408">Bug
140+ #27408</a>.</li>
141+ </ul>
142+</li>
143+
144+<li>Fixed hangs in etracer on 830 and 845
145+ chipsets. <a href="https://bugs.freedesktop.org/show_bug.cgi?id=26557">Bug
146+ #26557</a>.</li>
147+<li>Fixed tiling of small textures on all Intel drivers.</li>
148+<li>Fixed crash in Savage driver when using <code>_mesa_CopyTexImage2D</code>.
149+ <a href="https://bugs.freedesktop.org/show_bug.cgi?id=27652">Bug
150+ #27652</a>.</li>
151+
152+<li>Assorted GLX fixes. Including but not limited to:
153+ <ul>
154+ <li>Fixed <code>__glXInitializeVisualConfigFromTags</code>'s handling of
155+ unrecognized fbconfig tags.</li>
156+ <li>Fixed regression with <code>GLX_USE_GL</code>.
157+ <li>Fixed config chooser logic for 'mask' matching.</li>
158+ <li>Report swap events correctly in direct rendered case (DRI2)</li>
159+ <li>Fixed build with dri2proto which doesn't define
160+ <code>X_DRI2SwapInterval</code>.</li>
161+ <li>Get <code>GLX_SCREEN</code> first in <code>__glXQueryContextInfo</code>.
162+ <a href="https://bugs.freedesktop.org/show_bug.cgi?id=14245">Bug
163+ #14245</a>.</li>
164+ </ul>
165+</li>
166+
167+<li>Assorted GLSL fixes. Including but not limited to:
168+ <ul>
169+ <li>Change variable declared assertion into conditional in GLSL
170+ compiler. <a href="https://bugs.freedesktop.org/show_bug.cgi?id=27921">Bug
171+ #27921</a>.</li>
172+ <li>Fix instruction indexing
173+ bugs. <a href="https://bugs.freedesktop.org/show_bug.cgi?id=27566">Bug
174+ #27566</a>.</li>
175+ <li>Updated uniform location / offset encoding to be more like
176+ other implementations.</li>
177+ <li>Don't overwrite a driver's shader infolog with generic failure
178+ message.</li>
179+ </ul>
180+</li>
181+
182+<li>Fixed OSMesa build for 16 and 32-bit color channel depth.
183+<li>Fixed OSMesa build with hidden symbol visibility. libOSMesa no longer links to libGL.
184+ <a href="https://bugs.freedesktop.org/show_bug.cgi?id=28305">Bug
185+ #28305</a>.
186+<li>Fixed handling of multiple render targets in fixed-function
187+ texture envrionmnent programs.</li>
188+<li>Fixed conversion errors in <code>signed_rgba8888[rev]</code> texel
189+ fetch.</li>
190+<li>Don't set srcLevel on <code>GL_TEXTURE_RECTANGLE_ARB</code> targets.</li>
191+<li>Various build fixes for OpenBSD.</li>
192+<li>Various build fixes for OS X.</li>
193+<li>Various build fixes for GCC 3.3.</li>
194 </ul>
195
196
197-<h2>Changes</h2>
198-<p>None.</p>
199 </body>
200 </html>
201diff --git a/docs/relnotes-7.8.3.html b/docs/relnotes-7.8.3.html
202new file mode 100644
203index 0000000..1e9f433
204--- /dev/null
205+++ b/docs/relnotes-7.8.3.html
206@@ -0,0 +1,89 @@
207+<HTML>
208+
209+<TITLE>Mesa Release Notes</TITLE>
210+
211+<head><link rel="stylesheet" type="text/css" href="mesa.css"></head>
212+
213+<BODY>
214+
215+<body bgcolor="#eeeeee">
216+
217+<H1>Mesa 7.8.3 Release Notes / (date tbd)</H1>
218+
219+<p>
220+Mesa 7.8.3 is a bug fix release which fixes bugs found since the 7.8.2 release.
221+</p>
222+<p>
223+Mesa 7.8.3 implements the OpenGL 2.1 API, but the version reported by
224+glGetString(GL_VERSION) depends on the particular driver being used.
225+Some drivers don't support all the features required in OpenGL 2.1.
226+</p>
227+<p>
228+See the <a href="install.html">Compiling/Installing page</a> for prerequisites
229+for DRI hardware acceleration.
230+</p>
231+
232+
233+<h2>MD5 checksums</h2>
234+<pre>
235+x MesaLib-7.8.3.tar.gz
236+x MesaLib-7.8.3.tar.bz2
237+x MesaLib-7.8.3.zip
238+x MesaDemos-7.8.3.tar.gz
239+x MesaDemos-7.8.3.tar.bz2
240+x MesaDemos-7.8.3.zip
241+x MesaGLUT-7.8.3.tar.gz
242+x MesaGLUT-7.8.3.tar.bz2
243+x MesaGLUT-7.8.3.zip
244+</pre>
245+
246+
247+<h2>New features</h2>
248+<p>None.</p>
249+
250+
251+<h2>Changes</h2>
252+<ul>
253+<li>The radeon driver should use less memory when searching for a valid mip
254+image.</li>
255+</ul>
256+
257+
258+<h2>Bug fixes</h2>
259+<ul>
260+<li>Fix unsupported FB with D24S8 (bug
261+ <a href="https://bugs.freedesktop.org/show_bug.cgi?id=23670">29116</a>)</li>
262+<li>Fix ReadPixels crash when reading depth/stencil from an FBO</li>
263+<li>Fixed a bug rendering to 16-bit buffers using swrast.</li>
264+<li>Fixed a state tracker/TGSI bug that caused crashes when using Windows'
265+ memory debugging features.</li>
266+<li>Fixed an issue rendering to 32-bit channels with swrast (bug
267+ <a href="https://bugs.freedesktop.org/show_bug.cgi?id=29487">29487</a>)</li>
268+<li>GLSL: fix indirect <TT>gl_TextureMatrix</TT> addressing (bug
269+ <a href="https://bugs.freedesktop.org/show_bug.cgi?id=28967">28967</a>)</li>
270+<li>GLSL: fix for bug
271+ <a href="https://bugs.freedesktop.org/show_bug.cgi?id=27216">27216</a></li>
272+<li>GLSL: fix zw fragcoord entries in some cases (bug
273+ <a href="https://bugs.freedesktop.org/show_bug.cgi?id=29183">29183</a>)</li>
274+<li>Fix texture env generation in some cases (bug
275+ <a href="https://bugs.freedesktop.org/show_bug.cgi?id=28169">28169</a>)</li>
276+<li>osmesa: a fix for calling <TT>OSMesaMakeCurrent</TT> twice was applied (bug
277+ <a href="https://bugs.freedesktop.org/show_bug.cgi?id=10966">10966</a></li>
278+<li>A bug was fixed which could cause Mesa to ignore the
279+ <TT>MESA_EXTENSION_OVERRIDE</TT> environment variable.</li>
280+<li>A bug related to specular highlights on backfaces was fixed.</li>
281+<li>A radeon-specific issue with <TT>glCopyTex(Sub)Image</TT> was
282+ corrected.</li>
283+<li>radeon/wine: flush command stream in more cases, fixing wine d3d9
284+ tests.</li>
285+<li>r600: fix sin+cos normalization.</li>
286+<li>r600: (properly) ignore <TT>GL_COORD_REPLACE</TT> when point sprites are
287+ disabled.</li>
288+<li>radeon: avoid flushing when the context is not current.</li>
289+<li>r300c: a bug affecting unaligned BOs was fixed.</li>
290+<li>r300c: a hardlock caused by ARB_half_float_vertex incorrectly advertised on some chipsets.</li>
291+</ul>
292+
293+
294+</body>
295+</html>
296diff --git a/docs/relnotes-7.9.html b/docs/relnotes-7.9.html
297index b09fb1d..fe1fd5e 100644
298--- a/docs/relnotes-7.9.html
299+++ b/docs/relnotes-7.9.html
300@@ -28,12 +28,12 @@ for DRI hardware acceleration.
301
302 <h2>MD5 checksums</h2>
303 <pre>
304-f1f01a7baec255f13e9468fb4b05922a MesaLib-7.9-rc1.tar.gz
305-7ffbda3b7056c60b8f87e3082d853af1 MesaLib-7.9-rc1.tar.bz2
306-9d4650df4e5b530178d6fde840f76664 MesaLib-7.9-rc1.zip
307-a81c2e7a0c7832e67c768d6f209f2c8f MesaGLUT-7.9-rc1.tar.gz
308-b4c1c2f0b47a07be10fa2dd42e6a63d7 MesaGLUT-7.9-rc1.tar.bz2
309-c9dd7419a19bcb24a1fe556ec2e78451 MesaGLUT-7.9-rc1.zip
310+ed65ab425b25895c7f473d0a5e6e64f8 MesaLib-7.9.tar.gz
311+82c740c49d572baa6da2b1a1eee90bca MesaLib-7.9.tar.bz2
312+cd2b6ecec759b0457475e94bbb38fedb MesaLib-7.9.zip
313+7b54af9fb9b1f6a1a65db2520f50848f MesaGLUT-7.9.tar.gz
314+20d07419d1929f833fdb36bced290ad5 MesaGLUT-7.9.tar.bz2
315+62a7edecd7c92675cd6029b05217eb0a MesaGLUT-7.9.zip
316 </pre>
317
318
319diff --git a/docs/relnotes.html b/docs/relnotes.html
320index 47e7f80..4487af9 100644
321--- a/docs/relnotes.html
322+++ b/docs/relnotes.html
323@@ -14,6 +14,7 @@ The release notes summarize what's new or changed in each Mesa release.
324
325 <UL>
326 <LI><A HREF="relnotes-7.9.html">7.9 release notes</A>
327+<LI><A HREF="relnotes-7.8.3.html">7.8.3 release notes</A>
328 <LI><A HREF="relnotes-7.8.2.html">7.8.2 release notes</A>
329 <LI><A HREF="relnotes-7.8.1.html">7.8.1 release notes</A>
330 <LI><A HREF="relnotes-7.8.html">7.8 release notes</A>
c3c893c6
AM
331diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
332index 9c4ff56..4a6506c 100644
333--- a/src/egl/drivers/dri2/egl_dri2.c
334+++ b/src/egl/drivers/dri2/egl_dri2.c
335@@ -741,7 +741,7 @@ dri2_create_screen(_EGLDisplay *disp)
336 if (dri2_dpy->dri2->base.version >= 2)
337 api_mask = dri2_dpy->dri2->getAPIMask(dri2_dpy->dri_screen);
338 else
339- api_mask = __DRI_API_OPENGL;
340+ api_mask = 1 << __DRI_API_OPENGL;
341
342 disp->ClientAPIsMask = 0;
343 if (api_mask & (1 <<__DRI_API_OPENGL))
344diff --git a/src/egl/main/eglcontext.c b/src/egl/main/eglcontext.c
345index bc22913..763b1b3 100644
346--- a/src/egl/main/eglcontext.c
347+++ b/src/egl/main/eglcontext.c
348@@ -272,10 +272,6 @@ _eglCheckMakeCurrent(_EGLContext *ctx, _EGLSurface *draw, _EGLSurface *read)
349 if (!surfaceless && (draw == NULL || read == NULL))
350 return _eglError(EGL_BAD_MATCH, "eglMakeCurrent");
351
352- /* context stealing from another thread is not allowed */
353- if (ctx->Binding && ctx->Binding != t)
354- return _eglError(EGL_BAD_ACCESS, "eglMakeCurrent");
355-
356 /*
357 * The spec says
358 *
359@@ -283,16 +279,23 @@ _eglCheckMakeCurrent(_EGLContext *ctx, _EGLSurface *draw, _EGLSurface *read)
360 * bound to contexts in another thread, an EGL_BAD_ACCESS error is
361 * generated."
362 *
363- * But it also says
364+ * and
365 *
366 * "at most one context may be bound to a particular surface at a given
367 * time"
368- *
369- * The latter is more restrictive so we can check only the latter case.
370 */
371- if ((draw && draw->CurrentContext && draw->CurrentContext != ctx) ||
372- (read && read->CurrentContext && read->CurrentContext != ctx))
373+ if (ctx->Binding && ctx->Binding != t)
374 return _eglError(EGL_BAD_ACCESS, "eglMakeCurrent");
375+ if (draw && draw->CurrentContext && draw->CurrentContext != ctx) {
376+ if (draw->CurrentContext->Binding != t ||
377+ draw->CurrentContext->ClientAPI != ctx->ClientAPI)
378+ return _eglError(EGL_BAD_ACCESS, "eglMakeCurrent");
379+ }
380+ if (read && read->CurrentContext && read->CurrentContext != ctx) {
381+ if (read->CurrentContext->Binding != t ||
382+ read->CurrentContext->ClientAPI != ctx->ClientAPI)
383+ return _eglError(EGL_BAD_ACCESS, "eglMakeCurrent");
384+ }
385
386 /* simply require the configs to be equal */
387 if ((draw && draw->Config != ctx->Config) ||
9caf779f
AM
388diff --git a/src/gallium/state_trackers/egl/common/egl_g3d_api.c b/src/gallium/state_trackers/egl/common/egl_g3d_api.c
389index c0164da..3bde397 100644
390--- a/src/gallium/state_trackers/egl/common/egl_g3d_api.c
391+++ b/src/gallium/state_trackers/egl/common/egl_g3d_api.c
392@@ -609,8 +609,10 @@ egl_g3d_wait_client(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *ctx)
393
394 gctx->stctxi->flush(gctx->stctxi,
395 PIPE_FLUSH_RENDER_CACHE | PIPE_FLUSH_FRAME, &fence);
396- screen->fence_finish(screen, fence, 0);
397- screen->fence_reference(screen, &fence, NULL);
398+ if (fence) {
399+ screen->fence_finish(screen, fence, 0);
400+ screen->fence_reference(screen, &fence, NULL);
401+ }
402
403 return EGL_TRUE;
404 }
c3c893c6
AM
405diff --git a/src/gallium/state_trackers/vega/api_context.c b/src/gallium/state_trackers/vega/api_context.c
406index 0d04d8e..d6bbda5 100644
407--- a/src/gallium/state_trackers/vega/api_context.c
408+++ b/src/gallium/state_trackers/vega/api_context.c
409@@ -73,7 +73,8 @@ void vegaFinish(void)
410 pipe = ctx->pipe;
411
412 pipe->flush(pipe, PIPE_FLUSH_RENDER_CACHE | PIPE_FLUSH_FRAME, &fence);
413-
414- pipe->screen->fence_finish(pipe->screen, fence, 0);
415- pipe->screen->fence_reference(pipe->screen, &fence, NULL);
416+ if (fence) {
417+ pipe->screen->fence_finish(pipe->screen, fence, 0);
418+ pipe->screen->fence_reference(pipe->screen, &fence, NULL);
419+ }
420 }
9caf779f
AM
421diff --git a/src/gallium/state_trackers/vega/vg_manager.c b/src/gallium/state_trackers/vega/vg_manager.c
422index e799674..232deef 100644
423--- a/src/gallium/state_trackers/vega/vg_manager.c
424+++ b/src/gallium/state_trackers/vega/vg_manager.c
425@@ -352,7 +352,7 @@ vg_api_create_context(struct st_api *stapi, struct st_manager *smapi,
426 return NULL;
427
428 /* only 1.0 is supported */
429- if (attribs->major != 1 || attribs->minor > 0)
430+ if (attribs->major > 1 || (attribs->major == 1 && attribs->minor > 0))
431 return NULL;
432
433 pipe = smapi->screen->context_create(smapi->screen, NULL);
7959a51a
AM
434diff --git a/src/gallium/state_trackers/xorg/Makefile b/src/gallium/state_trackers/xorg/Makefile
435index cb2c3ae..7a44d28 100644
436--- a/src/gallium/state_trackers/xorg/Makefile
437+++ b/src/gallium/state_trackers/xorg/Makefile
438@@ -10,7 +10,7 @@ LIBRARY_INCLUDES = \
439 $(shell pkg-config libkms --atleast-version=1.0 \
440 && echo "-DHAVE_LIBKMS") \
441 $(shell pkg-config libkms --silence-errors --cflags-only-I) \
442- $(shell pkg-config --cflags-only-I pixman-1 xorg-server libdrm xproto) \
443+ $(shell pkg-config --cflags-only-I pixman-1 xorg-server libdrm xproto dri2proto) \
444 -I$(TOP)/src/gallium/include \
445 -I$(TOP)/src/gallium/auxiliary \
446 -I$(TOP)/include \
9caf779f 447diff --git a/src/gallium/state_trackers/xorg/xorg_crtc.c b/src/gallium/state_trackers/xorg/xorg_crtc.c
7959a51a 448index 26a907f..80af82d 100644
9caf779f
AM
449--- a/src/gallium/state_trackers/xorg/xorg_crtc.c
450+++ b/src/gallium/state_trackers/xorg/xorg_crtc.c
451@@ -234,6 +234,10 @@ crtc_load_cursor_argb_ga3d(xf86CrtcPtr crtc, CARD32 * image)
452 64, 64, (void*)image, 64 * 4, 0, 0);
453 ms->ctx->transfer_unmap(ms->ctx, transfer);
454 ms->ctx->transfer_destroy(ms->ctx, transfer);
455+
456+ if (crtc->cursor_shown)
457+ drmModeSetCursor(ms->fd, crtcp->drm_crtc->crtc_id,
458+ crtcp->cursor_handle, 64, 64);
459 }
460
461 #if HAVE_LIBKMS
462@@ -271,6 +275,10 @@ crtc_load_cursor_argb_kms(xf86CrtcPtr crtc, CARD32 * image)
463 memcpy(ptr, image, 64*64*4);
464 kms_bo_unmap(crtcp->cursor_bo);
465
466+ if (crtc->cursor_shown)
467+ drmModeSetCursor(ms->fd, crtcp->drm_crtc->crtc_id,
468+ crtcp->cursor_handle, 64, 64);
469+
470 return;
471
472 err_bo_destroy:
7959a51a
AM
473@@ -353,7 +361,7 @@ crtc_destroy(xf86CrtcPtr crtc)
474
475 drmModeFreeCrtc(crtcp->drm_crtc);
476
477- xfree(crtcp);
478+ free(crtcp);
479 crtc->driver_private = NULL;
480 }
481
482@@ -401,7 +409,7 @@ xorg_crtc_init(ScrnInfoPtr pScrn)
483 if (crtc == NULL)
484 goto out;
485
486- crtcp = xcalloc(1, sizeof(struct crtc_private));
487+ crtcp = calloc(1, sizeof(struct crtc_private));
488 if (!crtcp) {
489 xf86CrtcDestroy(crtc);
490 goto out;
491diff --git a/src/gallium/state_trackers/xorg/xorg_dri2.c b/src/gallium/state_trackers/xorg/xorg_dri2.c
492index 704aed6..b723a8e 100644
493--- a/src/gallium/state_trackers/xorg/xorg_dri2.c
494+++ b/src/gallium/state_trackers/xorg/xorg_dri2.c
495@@ -201,11 +201,11 @@ dri2_create_buffer(DrawablePtr pDraw, unsigned int attachment, unsigned int form
496 DRI2Buffer2Ptr buffer;
497 BufferPrivatePtr private;
498
499- buffer = xcalloc(1, sizeof *buffer);
500+ buffer = calloc(1, sizeof *buffer);
501 if (!buffer)
502 return NULL;
503
504- private = xcalloc(1, sizeof *private);
505+ private = calloc(1, sizeof *private);
506 if (!private) {
507 goto fail;
508 }
509@@ -217,9 +217,9 @@ dri2_create_buffer(DrawablePtr pDraw, unsigned int attachment, unsigned int form
510 if (dri2_do_create_buffer(pDraw, (DRI2BufferPtr)buffer, format))
511 return buffer;
512
513- xfree(private);
514+ free(private);
515 fail:
516- xfree(buffer);
517+ free(buffer);
518 return NULL;
519 }
520
521@@ -229,8 +229,8 @@ dri2_destroy_buffer(DrawablePtr pDraw, DRI2Buffer2Ptr buffer)
522 /* So far it is safe to downcast a DRI2Buffer2Ptr to DRI2BufferPtr */
523 dri2_do_destroy_buffer(pDraw, (DRI2BufferPtr)buffer);
524
525- xfree(buffer->driverPrivate);
526- xfree(buffer);
527+ free(buffer->driverPrivate);
528+ free(buffer);
529 }
530
531 #endif /* DRI2INFOREC_VERSION >= 2 */
532@@ -244,11 +244,11 @@ dri2_create_buffers(DrawablePtr pDraw, unsigned int *attachments, int count)
533 DRI2BufferPtr buffers;
534 int i;
535
536- buffers = xcalloc(count, sizeof *buffers);
537+ buffers = calloc(count, sizeof *buffers);
538 if (!buffers)
539 goto fail_buffers;
540
541- privates = xcalloc(count, sizeof *privates);
542+ privates = calloc(count, sizeof *privates);
543 if (!privates)
544 goto fail_privates;
545
546@@ -263,9 +263,9 @@ dri2_create_buffers(DrawablePtr pDraw, unsigned int *attachments, int count)
547 return buffers;
548
549 fail:
550- xfree(privates);
551+ free(privates);
552 fail_privates:
553- xfree(buffers);
554+ free(buffers);
555 fail_buffers:
556 return NULL;
557 }
558@@ -280,8 +280,8 @@ dri2_destroy_buffers(DrawablePtr pDraw, DRI2BufferPtr buffers, int count)
559 }
560
561 if (buffers) {
562- xfree(buffers[0].driverPrivate);
563- xfree(buffers);
564+ free(buffers[0].driverPrivate);
565+ free(buffers);
566 }
567 }
568
9caf779f 569diff --git a/src/gallium/state_trackers/xorg/xorg_driver.c b/src/gallium/state_trackers/xorg/xorg_driver.c
7959a51a 570index e10ff2f..1ec772d 100644
9caf779f
AM
571--- a/src/gallium/state_trackers/xorg/xorg_driver.c
572+++ b/src/gallium/state_trackers/xorg/xorg_driver.c
7959a51a
AM
573@@ -45,6 +45,7 @@
574 #include "miscstruct.h"
575 #include "dixstruct.h"
576 #include "xf86xv.h"
577+#include "xorgVersion.h"
578 #ifndef XSERVER_LIBPCIACCESS
579 #error "libpciaccess needed"
580 #endif
581@@ -122,7 +123,7 @@ xorg_tracker_set_functions(ScrnInfoPtr scrn)
582 Bool
583 xorg_tracker_have_modesetting(ScrnInfoPtr pScrn, struct pci_device *device)
584 {
585- char *BusID = xalloc(64);
586+ char *BusID = malloc(64);
587 sprintf(BusID, "pci:%04x:%02x:%02x.%d",
588 device->domain, device->bus,
589 device->dev, device->func);
590@@ -130,14 +131,14 @@ xorg_tracker_have_modesetting(ScrnInfoPtr pScrn, struct pci_device *device)
591 if (drmCheckModesettingSupported(BusID)) {
592 xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 0,
593 "Drm modesetting not supported %s\n", BusID);
594- xfree(BusID);
595+ free(BusID);
596 return FALSE;
597 }
598
599 xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 0,
600 "Drm modesetting supported on %s\n", BusID);
601
602- xfree(BusID);
603+ free(BusID);
604 return TRUE;
605 }
606
607@@ -174,7 +175,7 @@ drv_free_rec(ScrnInfoPtr pScrn)
608 if (!pScrn->driverPrivate)
609 return;
610
611- xfree(pScrn->driverPrivate);
612+ free(pScrn->driverPrivate);
613
614 pScrn->driverPrivate = NULL;
615 }
616@@ -274,7 +275,7 @@ drv_init_drm(ScrnInfoPtr pScrn)
617 if (ms->fd < 0) {
618 char *BusID;
619
620- BusID = xalloc(64);
621+ BusID = malloc(64);
622 sprintf(BusID, "PCI:%d:%d:%d",
623 ((ms->PciInfo->domain << 8) | ms->PciInfo->bus),
624 ms->PciInfo->dev, ms->PciInfo->func
625@@ -283,7 +284,7 @@ drv_init_drm(ScrnInfoPtr pScrn)
626
627 ms->fd = drmOpen(driver_descriptor.driver_name, BusID);
628 ms->isMaster = TRUE;
629- xfree(BusID);
630+ free(BusID);
631
632 if (ms->fd >= 0)
633 return TRUE;
634@@ -369,6 +370,7 @@ drv_pre_init(ScrnInfoPtr pScrn, int flags)
9caf779f
AM
635 ms = modesettingPTR(pScrn);
636 ms->pEnt = pEnt;
637 ms->cust = cust;
638+ ms->fb_id = -1;
639
640 pScrn->displayWidth = 640; /* default it */
641
7959a51a 642@@ -402,19 +404,6 @@ drv_pre_init(ScrnInfoPtr pScrn, int flags)
9caf779f
AM
643 if (!drv_init_drm(pScrn))
644 return FALSE;
645
646- use3D = cust ? !cust->no_3d : TRUE;
647- ms->from_3D = xf86GetOptValBool(ms->Options, OPTION_3D_ACCEL,
648- &use3D) ?
649- X_CONFIG : X_PROBED;
650-
651- ms->no3D = !use3D;
652-
653- if (!drv_init_resource_management(pScrn)) {
654- xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Could not init "
655- "Gallium3D or libKMS.");
656- return FALSE;
657- }
658-
659 pScrn->monitor = pScrn->confScreen->monitor;
660 pScrn->progClock = TRUE;
661 pScrn->rgbBits = 8;
7959a51a
AM
662@@ -444,11 +433,24 @@ drv_pre_init(ScrnInfoPtr pScrn, int flags)
663
664 /* Process the options */
665 xf86CollectOptions(pScrn, NULL);
666- if (!(ms->Options = xalloc(sizeof(drv_options))))
667+ if (!(ms->Options = malloc(sizeof(drv_options))))
668 return FALSE;
9caf779f
AM
669 memcpy(ms->Options, drv_options, sizeof(drv_options));
670 xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, ms->Options);
671
672+ use3D = cust ? !cust->no_3d : TRUE;
673+ ms->from_3D = xf86GetOptValBool(ms->Options, OPTION_3D_ACCEL,
674+ &use3D) ?
675+ X_CONFIG : X_PROBED;
676+
677+ ms->no3D = !use3D;
678+
679+ if (!drv_init_resource_management(pScrn)) {
680+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Could not init "
681+ "Gallium3D or libKMS.");
682+ return FALSE;
683+ }
684+
685 /* Allocate an xf86CrtcConfig */
686 xf86CrtcConfigInit(pScrn, &crtc_config_funcs);
687 xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
7959a51a 688@@ -791,7 +793,9 @@ drv_screen_init(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
9caf779f
AM
689 if (!ms->SWCursor)
690 xf86_cursors_init(pScreen, 64, 64,
691 HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_64 |
692- HARDWARE_CURSOR_ARGB);
693+ HARDWARE_CURSOR_ARGB |
694+ ((cust && cust->unhidden_hw_cursor_update) ?
695+ HARDWARE_CURSOR_UPDATE_UNHIDDEN : 0));
696
697 /* Must force it before EnterVT, so we are in control of VT and
698 * later memory should be bound when allocating, e.g rotate_mem */
7959a51a 699@@ -862,8 +866,10 @@ drv_leave_vt(int scrnIndex, int flags)
9caf779f
AM
700 }
701 }
702
703- drmModeRmFB(ms->fd, ms->fb_id);
704- ms->fb_id = -1;
705+ if (ms->fb_id != -1) {
706+ drmModeRmFB(ms->fd, ms->fb_id);
707+ ms->fb_id = -1;
708+ }
709
710 /* idle hardware */
711 if (!ms->kms)
7959a51a 712@@ -944,7 +950,6 @@ drv_close_screen(int scrnIndex, ScreenPtr pScreen)
9caf779f
AM
713 }
714 #endif
715
716- drmModeRmFB(ms->fd, ms->fb_id);
717 ms->destroy_front_buffer(pScrn);
718
719 if (ms->exa)
7959a51a
AM
720@@ -1178,6 +1183,8 @@ drv_bind_front_buffer_kms(ScrnInfoPtr pScrn)
721 stride,
722 ptr);
723
724+#if (XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(1, 9, 99, 1, 0))
725+
726 /* This a hack to work around EnableDisableFBAccess setting the pointer
727 * the real fix would be to replace pScrn->EnableDisableFBAccess hook
728 * and set the rootPixmap->devPrivate.ptr to something valid before that.
729@@ -1187,6 +1194,8 @@ drv_bind_front_buffer_kms(ScrnInfoPtr pScrn)
730 */
731 pScrn->pixmapPrivate.ptr = ptr;
732
733+#endif
734+
735 return TRUE;
736
737 err_destroy:
738diff --git a/src/gallium/state_trackers/xorg/xorg_exa.c b/src/gallium/state_trackers/xorg/xorg_exa.c
739index 6b2c80f..0e5693d 100644
740--- a/src/gallium/state_trackers/xorg/xorg_exa.c
741+++ b/src/gallium/state_trackers/xorg/xorg_exa.c
742@@ -720,7 +720,7 @@ ExaCreatePixmap(ScreenPtr pScreen, int size, int align)
743 {
744 struct exa_pixmap_priv *priv;
745
746- priv = xcalloc(1, sizeof(struct exa_pixmap_priv));
747+ priv = calloc(1, sizeof(struct exa_pixmap_priv));
748 if (!priv)
749 return NULL;
750
751@@ -737,7 +737,7 @@ ExaDestroyPixmap(ScreenPtr pScreen, void *dPriv)
752
753 pipe_resource_reference(&priv->tex, NULL);
754
755- xfree(priv);
756+ free(priv);
757 }
758
759 static Bool
760@@ -975,7 +975,7 @@ xorg_exa_close(ScrnInfoPtr pScrn)
761 ms->ctx = NULL;
762
763 exaDriverFini(pScrn->pScreen);
764- xfree(exa);
765+ free(exa);
766 ms->exa = NULL;
767 }
768
769@@ -987,7 +987,7 @@ xorg_exa_init(ScrnInfoPtr pScrn, Bool accel)
770 ExaDriverPtr pExa;
771 CustomizerPtr cust = ms->cust;
772
773- exa = xcalloc(1, sizeof(struct exa_context));
774+ exa = calloc(1, sizeof(struct exa_context));
775 if (!exa)
776 return NULL;
777
778diff --git a/src/gallium/state_trackers/xorg/xorg_output.c b/src/gallium/state_trackers/xorg/xorg_output.c
779index 61206ed..5555b51 100644
780--- a/src/gallium/state_trackers/xorg/xorg_output.c
781+++ b/src/gallium/state_trackers/xorg/xorg_output.c
782@@ -128,7 +128,7 @@ output_get_modes(xf86OutputPtr output)
783 for (i = 0; i < drm_connector->count_modes; i++) {
784 drm_mode = &drm_connector->modes[i];
785 if (drm_mode) {
786- mode = xcalloc(1, sizeof(DisplayModeRec));
787+ mode = calloc(1, sizeof(DisplayModeRec));
788 if (!mode)
789 continue;
790 mode->Clock = drm_mode->clock;
791@@ -195,7 +195,7 @@ output_destroy(xf86OutputPtr output)
792 {
793 struct output_private *priv = output->driver_private;
794 drmModeFreeConnector(priv->drm_connector);
795- xfree(priv);
796+ free(priv);
797 output->driver_private = NULL;
798 }
799
800@@ -262,14 +262,14 @@ xorg_output_init(ScrnInfoPtr pScrn)
801 drm_connector->connector_type_id);
802
803
804- priv = xcalloc(sizeof(*priv), 1);
805+ priv = calloc(sizeof(*priv), 1);
806 if (!priv) {
807 continue;
808 }
809
810 output = xf86OutputCreate(pScrn, &output_funcs, name);
811 if (!output) {
812- xfree(priv);
813+ free(priv);
814 continue;
815 }
816
9caf779f
AM
817diff --git a/src/gallium/state_trackers/xorg/xorg_tracker.h b/src/gallium/state_trackers/xorg/xorg_tracker.h
818index be1a9fd..a3fb5e5 100644
819--- a/src/gallium/state_trackers/xorg/xorg_tracker.h
820+++ b/src/gallium/state_trackers/xorg/xorg_tracker.h
821@@ -76,6 +76,7 @@ typedef struct _CustomizerRec
822 Bool dirty_throttling;
823 Bool swap_throttling;
824 Bool no_3d;
825+ Bool unhidden_hw_cursor_update;
826 Bool (*winsys_pre_init) (struct _CustomizerRec *cust, int fd);
827 Bool (*winsys_screen_init)(struct _CustomizerRec *cust);
828 Bool (*winsys_screen_close)(struct _CustomizerRec *cust);
7959a51a
AM
829diff --git a/src/gallium/state_trackers/xorg/xorg_xv.c b/src/gallium/state_trackers/xorg/xorg_xv.c
830index f98bd93..f64959f 100644
831--- a/src/gallium/state_trackers/xorg/xorg_xv.c
832+++ b/src/gallium/state_trackers/xorg/xorg_xv.c
833@@ -536,8 +536,10 @@ display_video(ScrnInfoPtr pScrn, struct xorg_xv_port_priv *pPriv, int id,
834 dst_surf = xorg_gpu_surface(pPriv->r->pipe->screen, dst);
835 hdtv = ((src_w >= RES_720P_X) && (src_h >= RES_720P_Y));
836
837+#ifdef COMPOSITE
838 REGION_TRANSLATE(pScrn->pScreen, dstRegion, -pPixmap->screen_x,
839 -pPixmap->screen_y);
840+#endif
841
842 dxo = dstRegion->extents.x1;
843 dyo = dstRegion->extents.y1;
844@@ -562,11 +564,16 @@ display_video(ScrnInfoPtr pScrn, struct xorg_xv_port_priv *pPriv, int id,
845 int box_y2 = pbox->y2;
846 float diff_x = (float)src_w / (float)dst_w;
847 float diff_y = (float)src_h / (float)dst_h;
848- float offset_x = box_x1 - dstX + pPixmap->screen_x;
849- float offset_y = box_y1 - dstY + pPixmap->screen_y;
850+ float offset_x = box_x1 - dstX;
851+ float offset_y = box_y1 - dstY;
852 float offset_w;
853 float offset_h;
854
855+#ifdef COMPOSITE
856+ offset_x += pPixmap->screen_x;
857+ offset_y += pPixmap->screen_y;
858+#endif
859+
860 x = box_x1;
861 y = box_y1;
862 w = box_x2 - box_x1;
863diff --git a/src/gallium/targets/Makefile.xorg b/src/gallium/targets/Makefile.xorg
864index 762c905..87eedd7 100644
865--- a/src/gallium/targets/Makefile.xorg
866+++ b/src/gallium/targets/Makefile.xorg
867@@ -29,7 +29,7 @@ INCLUDES = \
868 LIBNAME_STAGING = $(TOP)/$(LIB_DIR)/gallium/$(TARGET)
869
870 ifeq ($(MESA_LLVM),1)
871-LD = g++
872+LD = $(CXX)
873 LDFLAGS += $(LLVM_LDFLAGS)
874 USE_CXX=1
875 DRIVER_PIPES += $(TOP)/src/gallium/drivers/llvmpipe/libllvmpipe.a
876@@ -42,7 +42,7 @@ endif
877 default: depend $(TOP)/$(LIB_DIR)/gallium $(LIBNAME) $(LIBNAME_STAGING)
878
879 $(LIBNAME): $(OBJECTS) Makefile ../Makefile.xorg $(LIBS) $(DRIVER_PIPES)
880- $(MKLIB) -noprefix -o $@ $(LDFLAGS) $(OBJECTS) $(DRIVER_PIPES) $(GALLIUM_AUXILIARIES) $(DRIVER_LINKS)
881+ $(MKLIB) -linker $(CC) -noprefix -o $@ $(LDFLAGS) $(OBJECTS) $(DRIVER_PIPES) $(GALLIUM_AUXILIARIES) $(DRIVER_LINKS)
882
883 depend: $(C_SOURCES) $(CPP_SOURCES) $(ASM_SOURCES) $(SYMLINKS) $(GENERATED_SOURCES)
884 rm -f depend
9caf779f
AM
885diff --git a/src/gallium/targets/egl/Makefile b/src/gallium/targets/egl/Makefile
886index 47c24ce..38e60db 100644
887--- a/src/gallium/targets/egl/Makefile
888+++ b/src/gallium/targets/egl/Makefile
889@@ -24,7 +24,9 @@ common_CPPFLAGS := \
890 -I$(TOP)/src/gallium/auxiliary \
891 -I$(TOP)/src/gallium/drivers \
892 -I$(TOP)/src/gallium/include \
893- -I$(TOP)/src/gallium/winsys
894+ -I$(TOP)/src/gallium/winsys \
895+ $(LIBDRM_CFLAGS)
896+
897 common_SYS :=
898 common_LIBS := \
899 $(TOP)/src/gallium/drivers/identity/libidentity.a \
900@@ -41,11 +43,11 @@ egl_SYS := -lm $(DLOPEN_LIBS) -L$(TOP)/$(LIB_DIR) -lEGL
901 egl_LIBS := $(TOP)/src/gallium/state_trackers/egl/libegl.a
902
903 ifneq ($(findstring x11, $(EGL_PLATFORMS)),)
904-egl_SYS += -lX11 -lXext -lXfixes
905+egl_SYS += -lX11 -lXext -lXfixes $(LIBDRM_LIB)
906 egl_LIBS += $(TOP)/src/gallium/winsys/sw/xlib/libws_xlib.a
907 endif
908-ifneq ($(findstring kms, $(EGL_PLATFORMS)),)
909-egl_SYS += -ldrm
910+ifneq ($(findstring drm, $(EGL_PLATFORMS)),)
911+egl_SYS += $(LIBDRM_LIB)
912 endif
913 ifneq ($(findstring fbdev, $(EGL_PLATFORMS)),)
914 egl_LIBS += $(TOP)/src/gallium/winsys/sw/fbdev/libfbdev.a
7959a51a
AM
915diff --git a/src/gallium/targets/egl/pipe_i965.c b/src/gallium/targets/egl/pipe_i965.c
916index 43bf646..36b03b3 100644
917--- a/src/gallium/targets/egl/pipe_i965.c
918+++ b/src/gallium/targets/egl/pipe_i965.c
919@@ -1,6 +1,7 @@
920
921 #include "target-helpers/inline_wrapper_sw_helper.h"
922 #include "target-helpers/inline_debug_helper.h"
923+#include "target-helpers/inline_wrapper_sw_helper.h"
924 #include "state_tracker/drm_driver.h"
925 #include "i965/drm/i965_drm_public.h"
926 #include "i965/brw_public.h"
9caf779f 927diff --git a/src/gallium/targets/xorg-vmwgfx/vmw_ctrl.c b/src/gallium/targets/xorg-vmwgfx/vmw_ctrl.c
7959a51a 928index 237b308..9b422e6 100644
9caf779f
AM
929--- a/src/gallium/targets/xorg-vmwgfx/vmw_ctrl.c
930+++ b/src/gallium/targets/xorg-vmwgfx/vmw_ctrl.c
931@@ -32,6 +32,7 @@
932 * allows X clients to communicate with the driver.
933 */
934
935+#include <xorg-server.h>
936 #include "dixstruct.h"
937 #include "extnsionst.h"
938 #include <X11/X.h>
7959a51a
AM
939@@ -211,7 +212,7 @@ VMwareCtrlDoSetTopology(ScrnInfoPtr pScrn,
940 struct vmw_customizer *vmw = vmw_customizer(xorg_customizer(pScrn));
941 int i;
942
943- rects = xcalloc(number, sizeof(*rects));
944+ rects = calloc(number, sizeof(*rects));
945 if (!rects)
946 return FALSE;
947
948@@ -224,7 +225,7 @@ VMwareCtrlDoSetTopology(ScrnInfoPtr pScrn,
949
950 vmw_ioctl_update_layout(vmw, number, rects);
951
952- xfree(rects);
953+ free(rects);
954 return TRUE;
955 }
956
957diff --git a/src/gallium/targets/xorg-vmwgfx/vmw_ioctl.c b/src/gallium/targets/xorg-vmwgfx/vmw_ioctl.c
958index 7c799b5..7625d2f 100644
959--- a/src/gallium/targets/xorg-vmwgfx/vmw_ioctl.c
960+++ b/src/gallium/targets/xorg-vmwgfx/vmw_ioctl.c
961@@ -165,7 +165,7 @@ vmw_ioctl_buffer_create(struct vmw_customizer *vmw, uint32_t size, unsigned *han
962 struct drm_vmw_dmabuf_rep *rep = &arg.rep;
963 int ret;
964
965- buf = xcalloc(1, sizeof(*buf));
966+ buf = calloc(1, sizeof(*buf));
967 if (!buf)
968 goto err;
969
970@@ -192,7 +192,7 @@ vmw_ioctl_buffer_create(struct vmw_customizer *vmw, uint32_t size, unsigned *han
971 return buf;
972
973 err_free:
974- xfree(buf);
975+ free(buf);
976 err:
977 return NULL;
978 }
979@@ -211,7 +211,7 @@ vmw_ioctl_buffer_destroy(struct vmw_customizer *vmw, struct vmw_dma_buffer *buf)
980 arg.handle = buf->handle;
981 drmCommandWrite(vmw->fd, DRM_VMW_UNREF_DMABUF, &arg, sizeof(arg));
982
983- xfree(buf);
984+ free(buf);
985 }
986
987 void *
9caf779f
AM
988diff --git a/src/gallium/targets/xorg-vmwgfx/vmw_screen.c b/src/gallium/targets/xorg-vmwgfx/vmw_screen.c
989index 8173908..7662203 100644
990--- a/src/gallium/targets/xorg-vmwgfx/vmw_screen.c
991+++ b/src/gallium/targets/xorg-vmwgfx/vmw_screen.c
992@@ -245,6 +245,7 @@ vmw_screen_pre_init(ScrnInfoPtr pScrn, int flags)
993 cust->winsys_enter_vt = vmw_screen_enter_vt;
994 cust->winsys_leave_vt = vmw_screen_leave_vt;
995 cust->no_3d = TRUE;
996+ cust->unhidden_hw_cursor_update = TRUE;
997 vmw->pScrn = pScrn;
998
999 pScrn->driverPrivate = cust;
7959a51a
AM
1000diff --git a/src/gallium/targets/xorg-vmwgfx/vmw_video.c b/src/gallium/targets/xorg-vmwgfx/vmw_video.c
1001index eced60d..94465e5 100644
1002--- a/src/gallium/targets/xorg-vmwgfx/vmw_video.c
1003+++ b/src/gallium/targets/xorg-vmwgfx/vmw_video.c
1004@@ -300,7 +300,7 @@ vmw_video_init(struct vmw_customizer *vmw)
1005 numAdaptors = 1;
1006 overlayAdaptors = &newAdaptor;
1007 } else {
1008- newAdaptors = xalloc((numAdaptors + 1) *
1009+ newAdaptors = malloc((numAdaptors + 1) *
1010 sizeof(XF86VideoAdaptorPtr*));
1011 if (!newAdaptors) {
1012 xf86XVFreeVideoAdaptorRec(newAdaptor);
1013@@ -320,7 +320,7 @@ vmw_video_init(struct vmw_customizer *vmw)
1014 }
1015
1016 if (newAdaptors) {
1017- xfree(newAdaptors);
1018+ free(newAdaptors);
1019 }
1020
1021 debug_printf("Initialized VMware Xv extension successfully\n");
1022@@ -438,7 +438,7 @@ vmw_video_init_adaptor(ScrnInfoPtr pScrn, struct vmw_customizer *vmw)
1023 return NULL;
1024 }
1025
1026- video = xcalloc(1, sizeof(*video));
1027+ video = calloc(1, sizeof(*video));
1028 if (!video) {
1029 debug_printf("Not enough memory.\n");
1030 xf86XVFreeVideoAdaptorRec(adaptor);
1031@@ -742,7 +742,7 @@ vmw_video_buffer_alloc(struct vmw_customizer *vmw, int size,
1032 }
1033
1034 out->size = size;
1035- out->extra_data = xcalloc(1, size);
1036+ out->extra_data = calloc(1, size);
1037
1038 debug_printf("\t\t%s: allocated buffer %p of size %i\n", __func__, out, size);
1039
1040@@ -773,7 +773,7 @@ vmw_video_buffer_free(struct vmw_customizer *vmw,
1041 if (out->size == 0)
1042 return Success;
1043
1044- xfree(out->extra_data);
1045+ free(out->extra_data);
1046 vmw_ioctl_buffer_unmap(vmw, out->buf);
1047 vmw_ioctl_buffer_destroy(vmw, out->buf);
1048
1049diff --git a/src/mesa/Makefile b/src/mesa/Makefile
1050index c41c38c..7a6936e 100644
1051--- a/src/mesa/Makefile
1052+++ b/src/mesa/Makefile
1053@@ -34,7 +34,7 @@ ES1_CPPFLAGS := -DFEATURE_ES1=1 $(DEFINES)
1054 ES2_CPPFLAGS := -DFEATURE_ES2=1 $(DEFINES)
1055
1056 # append include dirs
1057-MESA_CPPFLAGS += $(INCLUDE_DIRS)
1058+MESA_CPPFLAGS += $(INCLUDE_DIRS) $(TALLOC_CFLAGS)
1059 ES1_CPPFLAGS += -I$(TOP)/src/mapi/es1api $(INCLUDE_DIRS)
1060 ES2_CPPFLAGS += -I$(TOP)/src/mapi/es2api $(INCLUDE_DIRS)
1061
9caf779f 1062diff --git a/src/mesa/drivers/dri/r200/r200_swtcl.c b/src/mesa/drivers/dri/r200/r200_swtcl.c
7959a51a 1063index dbf4ad4..160e7e7 100644
9caf779f
AM
1064--- a/src/mesa/drivers/dri/r200/r200_swtcl.c
1065+++ b/src/mesa/drivers/dri/r200/r200_swtcl.c
7959a51a
AM
1066@@ -319,10 +319,9 @@ static INLINE GLuint reduced_hw_prim( GLcontext *ctx, GLuint prim)
1067 {
1068 switch (prim) {
1069 case GL_POINTS:
1070- return (ctx->Point.PointSprite ||
1071- ((ctx->_TriangleCaps & (DD_POINT_SIZE | DD_POINT_ATTEN)) &&
1072- !(ctx->_TriangleCaps & (DD_POINT_SMOOTH)))) ?
1073- R200_VF_PRIM_POINT_SPRITES : R200_VF_PRIM_POINTS;
1074+ return (((R200_CONTEXT(ctx))->radeon.radeonScreen->drmSupportsPointSprites &&
1075+ !(ctx->_TriangleCaps & DD_POINT_SMOOTH)) ?
1076+ R200_VF_PRIM_POINT_SPRITES : R200_VF_PRIM_POINTS);
1077 case GL_LINES:
1078 /* fallthrough */
1079 case GL_LINE_LOOP:
1080@@ -613,6 +612,9 @@ static void r200RasterPrimitive( GLcontext *ctx, GLuint hwprim )
9caf779f
AM
1081 r200ContextPtr rmesa = R200_CONTEXT(ctx);
1082
1083 radeon_prepare_render(&rmesa->radeon);
1084+ if (rmesa->radeon.NewGLState)
1085+ r200ValidateState( ctx );
1086+
1087
1088 if (rmesa->radeon.swtcl.hw_primitive != hwprim) {
1089 /* need to disable perspective-correct texturing for point sprites */
1090diff --git a/src/mesa/drivers/dri/r200/r200_tcl.c b/src/mesa/drivers/dri/r200/r200_tcl.c
7959a51a 1091index 4ae0f30..2743997 100644
9caf779f
AM
1092--- a/src/mesa/drivers/dri/r200/r200_tcl.c
1093+++ b/src/mesa/drivers/dri/r200/r200_tcl.c
7959a51a
AM
1094@@ -68,9 +68,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1095 #define HAVE_ELTS 1
1096
1097
1098-#define HW_POINTS ((ctx->Point.PointSprite || \
1099- ((ctx->_TriangleCaps & (DD_POINT_SIZE | DD_POINT_ATTEN)) && \
1100- !(ctx->_TriangleCaps & (DD_POINT_SMOOTH)))) ? \
1101+#define HW_POINTS (((R200_CONTEXT(ctx))->radeon.radeonScreen->drmSupportsPointSprites && \
1102+ !(ctx->_TriangleCaps & DD_POINT_SMOOTH)) ? \
1103 R200_VF_PRIM_POINT_SPRITES : R200_VF_PRIM_POINTS)
1104 #define HW_LINES R200_VF_PRIM_LINES
1105 #define HW_LINE_LOOP 0
1106@@ -265,6 +264,8 @@ void r200TclPrimitive( GLcontext *ctx,
9caf779f
AM
1107 GLuint newprim = hw_prim | R200_VF_TCL_OUTPUT_VTX_ENABLE;
1108
1109 radeon_prepare_render(&rmesa->radeon);
1110+ if (rmesa->radeon.NewGLState)
1111+ r200ValidateState( ctx );
1112
1113 if (newprim != rmesa->tcl.hw_primitive ||
1114 !discrete_prim[hw_prim&0xf]) {
7959a51a
AM
1115diff --git a/src/mesa/drivers/dri/r300/r300_draw.c b/src/mesa/drivers/dri/r300/r300_draw.c
1116index 5ae9f49..767778b 100644
1117--- a/src/mesa/drivers/dri/r300/r300_draw.c
1118+++ b/src/mesa/drivers/dri/r300/r300_draw.c
1119@@ -717,6 +717,10 @@ static void r300DrawPrims(GLcontext *ctx,
1120 GLuint max_index)
1121 {
1122 GLboolean retval;
1123+ struct r300_context *r300 = R300_CONTEXT(ctx);
1124+ radeonContextPtr radeon = &r300->radeon;
1125+
1126+ radeon_prepare_render(radeon);
1127
1128 /* This check should get folded into just the places that
1129 * min/max index are really needed.
1130diff --git a/src/mesa/drivers/dri/r300/r300_render.c b/src/mesa/drivers/dri/r300/r300_render.c
1131index cf89ab7..bb8f914 100644
1132--- a/src/mesa/drivers/dri/r300/r300_render.c
1133+++ b/src/mesa/drivers/dri/r300/r300_render.c
1134@@ -327,8 +327,6 @@ void r300RunRenderPrimitive(GLcontext * ctx, int start, int end, int prim)
1135 BATCH_LOCALS(&rmesa->radeon);
1136 int type, num_verts;
1137
1138- radeon_prepare_render(&rmesa->radeon);
1139-
1140 type = r300PrimitiveType(rmesa, prim);
1141 num_verts = r300NumVerts(rmesa, end - start, prim);
1142
1143diff --git a/src/mesa/drivers/dri/r600/evergreen_render.c b/src/mesa/drivers/dri/r600/evergreen_render.c
1144index 27089bf..1fa53d7 100644
1145--- a/src/mesa/drivers/dri/r600/evergreen_render.c
1146+++ b/src/mesa/drivers/dri/r600/evergreen_render.c
1147@@ -909,6 +909,10 @@ static void evergreenDrawPrims(GLcontext *ctx,
1148 {
1149 GLboolean retval = GL_FALSE;
1150
1151+ context_t *context = EVERGREEN_CONTEXT(ctx);
1152+ radeonContextPtr radeon = &context->radeon;
1153+ radeon_prepare_render(radeon);
1154+
1155 /* This check should get folded into just the places that
1156 * min/max index are really needed.
1157 */
9caf779f 1158diff --git a/src/mesa/drivers/dri/radeon/radeon_common_context.c b/src/mesa/drivers/dri/radeon/radeon_common_context.c
7959a51a 1159index 85e4988..d4c7864 100644
9caf779f
AM
1160--- a/src/mesa/drivers/dri/radeon/radeon_common_context.c
1161+++ b/src/mesa/drivers/dri/radeon/radeon_common_context.c
7959a51a
AM
1162@@ -251,9 +251,9 @@ GLboolean radeonInitContext(radeonContextPtr radeon,
1163 radeon->texture_rect_row_align = 512;
1164 radeon->texture_compressed_row_align = 512;
1165 } else {
1166- radeon->texture_row_align = 256;
1167- radeon->texture_rect_row_align = 256;
1168- radeon->texture_compressed_row_align = 256;
1169+ radeon->texture_row_align = radeon->radeonScreen->group_bytes;
1170+ radeon->texture_rect_row_align = radeon->radeonScreen->group_bytes;
1171+ radeon->texture_compressed_row_align = radeon->radeonScreen->group_bytes;
1172 }
1173 } else if (IS_R200_CLASS(radeon->radeonScreen) ||
1174 IS_R100_CLASS(radeon->radeonScreen)) {
9caf779f
AM
1175@@ -521,6 +521,7 @@ void radeon_prepare_render(radeonContextPtr radeon)
1176 __DRIcontext *driContext = radeon->dri.context;
1177 __DRIdrawable *drawable;
1178 __DRIscreen *screen;
1179+ struct radeon_framebuffer *draw;
1180
1181 screen = driContext->driScreenPriv;
1182 if (!screen->dri2.loader)
1183@@ -531,9 +532,10 @@ void radeon_prepare_render(radeonContextPtr radeon)
1184 if (drawable->lastStamp != drawable->dri2.stamp)
1185 radeon_update_renderbuffers(driContext, drawable, GL_FALSE);
1186
1187- /* Intel driver does the equivalent of this, no clue if it is needed:
1188- * radeon_draw_buffer(radeon->glCtx, &(drawable->driverPrivate)->base);
1189- */
1190+ /* Intel driver does the equivalent of this, no clue if it is needed:*/
1191+ draw = drawable->driverPrivate;
1192+ radeon_draw_buffer(radeon->glCtx, &draw->base);
1193+
1194 driContext->dri2.draw_stamp = drawable->dri2.stamp;
1195 }
1196
7959a51a
AM
1197@@ -738,10 +740,9 @@ radeon_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable,
1198 buffers[i].flags);
1199
1200 if (bo == NULL) {
1201-
1202 fprintf(stderr, "failed to attach %s %d\n",
1203 regname, buffers[i].name);
1204-
1205+ continue;
1206 }
1207
1208 ret = radeon_bo_get_tiling(bo, &tiling_flags, &pitch);
1209diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c
1210index 2ea77e5..0ca052d 100644
1211--- a/src/mesa/drivers/dri/radeon/radeon_screen.c
1212+++ b/src/mesa/drivers/dri/radeon/radeon_screen.c
1213@@ -1138,6 +1138,8 @@ radeonCreateScreen( __DRIscreen *sPriv )
1214 else
1215 screen->chip_flags |= RADEON_CLASS_R600;
1216
1217+ /* set group bytes for r6xx+ */
1218+ screen->group_bytes = 256;
1219 screen->cpp = dri_priv->bpp / 8;
1220 screen->AGPMode = dri_priv->AGPMode;
1221
1222@@ -1382,7 +1384,8 @@ radeonCreateScreen2(__DRIscreen *sPriv)
1223 else
1224 screen->chip_flags |= RADEON_CLASS_R600;
1225
1226- /* r6xx+ tiling */
1227+ /* r6xx+ tiling, default to 256 group bytes */
1228+ screen->group_bytes = 256;
1229 if (IS_R600_CLASS(screen) && (sPriv->drm_version.minor >= 6)) {
1230 ret = radeonGetParam(sPriv, RADEON_INFO_TILE_CONFIG, &temp);
1231 if (ret)
1232diff --git a/src/mesa/drivers/dri/radeon/radeon_swtcl.c b/src/mesa/drivers/dri/radeon/radeon_swtcl.c
1233index 29defe7..0a81843 100644
1234--- a/src/mesa/drivers/dri/radeon/radeon_swtcl.c
1235+++ b/src/mesa/drivers/dri/radeon/radeon_swtcl.c
1236@@ -412,6 +412,8 @@ static GLboolean radeon_run_render( GLcontext *ctx,
1237 return GL_TRUE;
1238
1239 radeon_prepare_render(&rmesa->radeon);
1240+ if (rmesa->radeon.NewGLState)
1241+ radeonValidateState( ctx );
1242
1243 tnl->Driver.Render.Start( ctx );
1244
1245diff --git a/src/mesa/drivers/dri/radeon/radeon_tcl.c b/src/mesa/drivers/dri/radeon/radeon_tcl.c
1246index 5e1718f..ded3ebe 100644
1247--- a/src/mesa/drivers/dri/radeon/radeon_tcl.c
1248+++ b/src/mesa/drivers/dri/radeon/radeon_tcl.c
1249@@ -253,6 +253,8 @@ void radeonTclPrimitive( GLcontext *ctx,
1250 GLuint newprim = hw_prim | RADEON_CP_VC_CNTL_TCL_ENABLE;
1251
1252 radeon_prepare_render(&rmesa->radeon);
1253+ if (rmesa->radeon.NewGLState)
1254+ radeonValidateState( ctx );
1255
1256 if (newprim != rmesa->tcl.hw_primitive ||
1257 !discrete_prim[hw_prim&0xf]) {
c3c893c6
AM
1258diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
1259index 4797f29..d9eaada 100644
1260--- a/src/mesa/main/bufferobj.c
1261+++ b/src/mesa/main/bufferobj.c
1262@@ -55,6 +55,13 @@
1263
1264
1265 /**
1266+ * Used as a placeholder for buffer objects between glGenBuffers() and
1267+ * glBindBuffer() so that glIsBuffer() can work correctly.
1268+ */
1269+static struct gl_buffer_object DummyBufferObject;
1270+
1271+
1272+/**
1273 * Return pointer to address of a buffer object target.
1274 * \param ctx the GL context
1275 * \param target the buffer object target to be retrieved.
1276@@ -554,6 +561,9 @@ _mesa_copy_buffer_subdata(GLcontext *ctx,
1277 void
1278 _mesa_init_buffer_objects( GLcontext *ctx )
1279 {
1280+ memset(&DummyBufferObject, 0, sizeof(DummyBufferObject));
1281+ DummyBufferObject.RefCount = 1000*1000*1000; /* never delete */
1282+
1283 _mesa_reference_buffer_object(ctx, &ctx->Array.ArrayBufferObj,
1284 ctx->Shared->NullBufferObj);
1285 _mesa_reference_buffer_object(ctx, &ctx->Array.ElementArrayBufferObj,
1286@@ -611,8 +621,10 @@ bind_buffer_object(GLcontext *ctx, GLenum target, GLuint buffer)
1287 else {
1288 /* non-default buffer object */
1289 newBufObj = _mesa_lookup_bufferobj(ctx, buffer);
1290- if (!newBufObj) {
1291- /* if this is a new buffer object id, allocate a buffer object now */
1292+ if (!newBufObj || newBufObj == &DummyBufferObject) {
1293+ /* If this is a new buffer object id, or one which was generated but
1294+ * never used before, allocate a buffer object now.
1295+ */
1296 ASSERT(ctx->Driver.NewBufferObject);
1297 newBufObj = ctx->Driver.NewBufferObject(ctx, buffer, target);
1298 if (!newBufObj) {
1299@@ -992,7 +1004,7 @@ _mesa_DeleteBuffersARB(GLsizei n, const GLuint *ids)
1300 struct gl_array_object *arrayObj = ctx->Array.ArrayObj;
1301 GLuint j;
1302
1303- ASSERT(bufObj->Name == ids[i]);
1304+ ASSERT(bufObj->Name == ids[i] || bufObj == &DummyBufferObject);
1305
1306 if (_mesa_bufferobj_mapped(bufObj)) {
1307 /* if mapped, unmap it now */
1308@@ -1033,7 +1045,7 @@ _mesa_DeleteBuffersARB(GLsizei n, const GLuint *ids)
1309 }
1310
1311 /* The ID is immediately freed for re-use */
1312- _mesa_HashRemove(ctx->Shared->BufferObjects, bufObj->Name);
1313+ _mesa_HashRemove(ctx->Shared->BufferObjects, ids[i]);
1314 _mesa_reference_buffer_object(ctx, &bufObj, NULL);
1315 }
1316 }
1317@@ -1072,18 +1084,10 @@ _mesa_GenBuffersARB(GLsizei n, GLuint *buffer)
1318
1319 first = _mesa_HashFindFreeKeyBlock(ctx->Shared->BufferObjects, n);
1320
1321- /* Allocate new, empty buffer objects and return identifiers */
1322+ /* Insert the ID and pointer to dummy buffer object into hash table */
1323 for (i = 0; i < n; i++) {
1324- struct gl_buffer_object *bufObj;
1325- GLuint name = first + i;
1326- GLenum target = 0;
1327- bufObj = ctx->Driver.NewBufferObject( ctx, name, target );
1328- if (!bufObj) {
1329- _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex);
1330- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glGenBuffersARB");
1331- return;
1332- }
1333- _mesa_HashInsert(ctx->Shared->BufferObjects, first + i, bufObj);
1334+ _mesa_HashInsert(ctx->Shared->BufferObjects, first + i,
1335+ &DummyBufferObject);
1336 buffer[i] = first + i;
1337 }
1338
1339@@ -1109,7 +1113,7 @@ _mesa_IsBufferARB(GLuint id)
1340 bufObj = _mesa_lookup_bufferobj(ctx, id);
1341 _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex);
1342
1343- return bufObj ? GL_TRUE : GL_FALSE;
1344+ return bufObj && bufObj != &DummyBufferObject;
1345 }
1346
1347
1348diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c
1349index 9db9f1c..c3fe8a3 100644
1350--- a/src/mesa/main/formats.c
1351+++ b/src/mesa/main/formats.c
1352@@ -1109,6 +1109,7 @@ _mesa_format_to_type_and_comps(gl_format format,
1353 case MESA_FORMAT_ARGB8888:
1354 case MESA_FORMAT_ARGB8888_REV:
1355 case MESA_FORMAT_XRGB8888:
1356+ case MESA_FORMAT_XRGB8888_REV:
1357 *datatype = GL_UNSIGNED_BYTE;
1358 *comps = 4;
1359 return;
1360@@ -1135,6 +1136,11 @@ _mesa_format_to_type_and_comps(gl_format format,
1361 *comps = 4;
1362 return;
1363
1364+ case MESA_FORMAT_RGBA5551:
1365+ *datatype = GL_UNSIGNED_SHORT_5_5_5_1;
1366+ *comps = 4;
1367+ return;
1368+
1369 case MESA_FORMAT_AL88:
1370 case MESA_FORMAT_AL88_REV:
1371 *datatype = GL_UNSIGNED_BYTE;
1372@@ -1156,6 +1162,7 @@ _mesa_format_to_type_and_comps(gl_format format,
1373 case MESA_FORMAT_L8:
1374 case MESA_FORMAT_I8:
1375 case MESA_FORMAT_CI8:
1376+ case MESA_FORMAT_S8:
1377 *datatype = GL_UNSIGNED_BYTE;
1378 *comps = 1;
1379 return;
1380@@ -1201,12 +1208,26 @@ _mesa_format_to_type_and_comps(gl_format format,
1381 *comps = 2;
1382 return;
1383
1384+ case MESA_FORMAT_SIGNED_R8:
1385+ *datatype = GL_BYTE;
1386+ *comps = 1;
1387+ return;
1388+ case MESA_FORMAT_SIGNED_RG88:
1389+ *datatype = GL_BYTE;
1390+ *comps = 2;
1391+ return;
1392 case MESA_FORMAT_SIGNED_RGBA8888:
1393 case MESA_FORMAT_SIGNED_RGBA8888_REV:
1394+ case MESA_FORMAT_SIGNED_RGBX8888:
1395 *datatype = GL_BYTE;
1396 *comps = 4;
1397 return;
1398
1399+ case MESA_FORMAT_RGBA_16:
1400+ *datatype = GL_UNSIGNED_SHORT;
1401+ *comps = 4;
1402+ return;
1403+
1404 case MESA_FORMAT_SIGNED_R_16:
1405 *datatype = GL_SHORT;
1406 *comps = 1;
1407@@ -1331,9 +1352,14 @@ _mesa_format_to_type_and_comps(gl_format format,
1408 *comps = 4;
1409 return;
1410
1411-
1412+ case MESA_FORMAT_NONE:
1413+ case MESA_FORMAT_COUNT:
1414+ /* For debug builds, warn if any formats are not handled */
1415+#ifndef DEBUG
1416 default:
1417- _mesa_problem(NULL, "bad format in _mesa_format_to_type_and_comps");
1418+#endif
1419+ _mesa_problem(NULL, "bad format %s in _mesa_format_to_type_and_comps",
1420+ _mesa_get_format_name(format));
1421 *datatype = 0;
1422 *comps = 1;
1423 }
7959a51a 1424diff --git a/src/mesa/main/mipmap.c b/src/mesa/main/mipmap.c
c3c893c6 1425index 3d1a4c4..71aa8c2 100644
7959a51a
AM
1426--- a/src/mesa/main/mipmap.c
1427+++ b/src/mesa/main/mipmap.c
c3c893c6
AM
1428@@ -288,6 +288,54 @@ do_row(GLenum datatype, GLuint comps, GLint srcWidth,
1429 dst[i] = (rowA[j] + rowA[k] + rowB[j] + rowB[k]) / 4;
1430 }
1431 }
1432+
1433+ else if (datatype == GL_SHORT && comps == 4) {
1434+ GLuint i, j, k;
1435+ const GLshort(*rowA)[4] = (const GLshort(*)[4]) srcRowA;
1436+ const GLshort(*rowB)[4] = (const GLshort(*)[4]) srcRowB;
1437+ GLshort(*dst)[4] = (GLshort(*)[4]) dstRow;
1438+ for (i = j = 0, k = k0; i < (GLuint) dstWidth;
1439+ i++, j += colStride, k += colStride) {
1440+ dst[i][0] = (rowA[j][0] + rowA[k][0] + rowB[j][0] + rowB[k][0]) / 4;
1441+ dst[i][1] = (rowA[j][1] + rowA[k][1] + rowB[j][1] + rowB[k][1]) / 4;
1442+ dst[i][2] = (rowA[j][2] + rowA[k][2] + rowB[j][2] + rowB[k][2]) / 4;
1443+ dst[i][3] = (rowA[j][3] + rowA[k][3] + rowB[j][3] + rowB[k][3]) / 4;
1444+ }
1445+ }
1446+ else if (datatype == GL_SHORT && comps == 3) {
1447+ GLuint i, j, k;
1448+ const GLshort(*rowA)[3] = (const GLshort(*)[3]) srcRowA;
1449+ const GLshort(*rowB)[3] = (const GLshort(*)[3]) srcRowB;
1450+ GLshort(*dst)[3] = (GLshort(*)[3]) dstRow;
1451+ for (i = j = 0, k = k0; i < (GLuint) dstWidth;
1452+ i++, j += colStride, k += colStride) {
1453+ dst[i][0] = (rowA[j][0] + rowA[k][0] + rowB[j][0] + rowB[k][0]) / 4;
1454+ dst[i][1] = (rowA[j][1] + rowA[k][1] + rowB[j][1] + rowB[k][1]) / 4;
1455+ dst[i][2] = (rowA[j][2] + rowA[k][2] + rowB[j][2] + rowB[k][2]) / 4;
1456+ }
1457+ }
1458+ else if (datatype == GL_SHORT && comps == 2) {
1459+ GLuint i, j, k;
1460+ const GLshort(*rowA)[2] = (const GLshort(*)[2]) srcRowA;
1461+ const GLshort(*rowB)[2] = (const GLshort(*)[2]) srcRowB;
1462+ GLshort(*dst)[2] = (GLshort(*)[2]) dstRow;
1463+ for (i = j = 0, k = k0; i < (GLuint) dstWidth;
1464+ i++, j += colStride, k += colStride) {
1465+ dst[i][0] = (rowA[j][0] + rowA[k][0] + rowB[j][0] + rowB[k][0]) / 4;
1466+ dst[i][1] = (rowA[j][1] + rowA[k][1] + rowB[j][1] + rowB[k][1]) / 4;
1467+ }
1468+ }
1469+ else if (datatype == GL_SHORT && comps == 1) {
1470+ GLuint i, j, k;
1471+ const GLshort *rowA = (const GLshort *) srcRowA;
1472+ const GLshort *rowB = (const GLshort *) srcRowB;
1473+ GLshort *dst = (GLshort *) dstRow;
1474+ for (i = j = 0, k = k0; i < (GLuint) dstWidth;
1475+ i++, j += colStride, k += colStride) {
1476+ dst[i] = (rowA[j] + rowA[k] + rowB[j] + rowB[k]) / 4;
1477+ }
1478+ }
1479+
1480 else if (datatype == GL_FLOAT && comps == 4) {
1481 GLuint i, j, k;
1482 const GLfloat(*rowA)[4] = (const GLfloat(*)[4]) srcRowA;
1483@@ -507,6 +555,37 @@ do_row(GLenum datatype, GLuint comps, GLint srcWidth,
1484 dst[i] = (alpha << 15) | (blue << 10) | (green << 5) | red;
1485 }
1486 }
1487+ else if (datatype == GL_UNSIGNED_SHORT_5_5_5_1 && comps == 4) {
1488+ GLuint i, j, k;
1489+ const GLushort *rowA = (const GLushort *) srcRowA;
1490+ const GLushort *rowB = (const GLushort *) srcRowB;
1491+ GLushort *dst = (GLushort *) dstRow;
1492+ for (i = j = 0, k = k0; i < (GLuint) dstWidth;
1493+ i++, j += colStride, k += colStride) {
1494+ const GLint rowAr0 = (rowA[j] >> 11) & 0x1f;
1495+ const GLint rowAr1 = (rowA[k] >> 11) & 0x1f;
1496+ const GLint rowBr0 = (rowB[j] >> 11) & 0x1f;
1497+ const GLint rowBr1 = (rowB[k] >> 11) & 0x1f;
1498+ const GLint rowAg0 = (rowA[j] >> 6) & 0x1f;
1499+ const GLint rowAg1 = (rowA[k] >> 6) & 0x1f;
1500+ const GLint rowBg0 = (rowB[j] >> 6) & 0x1f;
1501+ const GLint rowBg1 = (rowB[k] >> 6) & 0x1f;
1502+ const GLint rowAb0 = (rowA[j] >> 1) & 0x1f;
1503+ const GLint rowAb1 = (rowA[k] >> 1) & 0x1f;
1504+ const GLint rowBb0 = (rowB[j] >> 1) & 0x1f;
1505+ const GLint rowBb1 = (rowB[k] >> 1) & 0x1f;
1506+ const GLint rowAa0 = (rowA[j] & 0x1);
1507+ const GLint rowAa1 = (rowA[k] & 0x1);
1508+ const GLint rowBa0 = (rowB[j] & 0x1);
1509+ const GLint rowBa1 = (rowB[k] & 0x1);
1510+ const GLint red = (rowAr0 + rowAr1 + rowBr0 + rowBr1) >> 2;
1511+ const GLint green = (rowAg0 + rowAg1 + rowBg0 + rowBg1) >> 2;
1512+ const GLint blue = (rowAb0 + rowAb1 + rowBb0 + rowBb1) >> 2;
1513+ const GLint alpha = (rowAa0 + rowAa1 + rowBa0 + rowBa1) >> 2;
1514+ dst[i] = (red << 11) | (green << 6) | (blue << 1) | alpha;
1515+ }
1516+ }
1517+
1518 else if (datatype == GL_UNSIGNED_BYTE_3_3_2 && comps == 3) {
1519 GLuint i, j, k;
1520 const GLubyte *rowA = (const GLubyte *) srcRowA;
1521@@ -606,7 +685,7 @@ do_row_3D(GLenum datatype, GLuint comps, GLint srcWidth,
7959a51a
AM
1522 FILTER_3D(0);
1523 }
1524 }
1525- if ((datatype == GL_BYTE) && (comps == 4)) {
1526+ else if ((datatype == GL_BYTE) && (comps == 4)) {
1527 DECLARE_ROW_POINTERS(GLbyte, 4);
1528
1529 for (i = j = 0, k = k0; i < (GLuint) dstWidth;
c3c893c6
AM
1530@@ -682,6 +761,44 @@ do_row_3D(GLenum datatype, GLuint comps, GLint srcWidth,
1531 FILTER_3D(0);
1532 }
1533 }
1534+ else if ((datatype == GL_SHORT) && (comps == 4)) {
1535+ DECLARE_ROW_POINTERS(GLshort, 4);
1536+
1537+ for (i = j = 0, k = k0; i < (GLuint) dstWidth;
1538+ i++, j += colStride, k += colStride) {
1539+ FILTER_3D(0);
1540+ FILTER_3D(1);
1541+ FILTER_3D(2);
1542+ FILTER_3D(3);
1543+ }
1544+ }
1545+ else if ((datatype == GL_SHORT) && (comps == 3)) {
1546+ DECLARE_ROW_POINTERS(GLshort, 3);
1547+
1548+ for (i = j = 0, k = k0; i < (GLuint) dstWidth;
1549+ i++, j += colStride, k += colStride) {
1550+ FILTER_3D(0);
1551+ FILTER_3D(1);
1552+ FILTER_3D(2);
1553+ }
1554+ }
1555+ else if ((datatype == GL_SHORT) && (comps == 2)) {
1556+ DECLARE_ROW_POINTERS(GLshort, 2);
1557+
1558+ for (i = j = 0, k = k0; i < (GLuint) dstWidth;
1559+ i++, j += colStride, k += colStride) {
1560+ FILTER_3D(0);
1561+ FILTER_3D(1);
1562+ }
1563+ }
1564+ else if ((datatype == GL_SHORT) && (comps == 1)) {
1565+ DECLARE_ROW_POINTERS(GLshort, 1);
1566+
1567+ for (i = j = 0, k = k0; i < (GLuint) dstWidth;
1568+ i++, j += colStride, k += colStride) {
1569+ FILTER_3D(0);
1570+ }
1571+ }
1572 else if ((datatype == GL_FLOAT) && (comps == 4)) {
1573 DECLARE_ROW_POINTERS(GLfloat, 4);
1574
1575@@ -910,6 +1027,55 @@ do_row_3D(GLenum datatype, GLuint comps, GLint srcWidth,
1576 dst[i] = (a << 15) | (b << 10) | (g << 5) | r;
1577 }
1578 }
1579+ else if ((datatype == GL_UNSIGNED_SHORT_5_5_5_1) && (comps == 4)) {
1580+ DECLARE_ROW_POINTERS0(GLushort);
1581+
1582+ for (i = j = 0, k = k0; i < (GLuint) dstWidth;
1583+ i++, j += colStride, k += colStride) {
1584+ const GLint rowAr0 = (rowA[j] >> 11) & 0x1f;
1585+ const GLint rowAr1 = (rowA[k] >> 11) & 0x1f;
1586+ const GLint rowBr0 = (rowB[j] >> 11) & 0x1f;
1587+ const GLint rowBr1 = (rowB[k] >> 11) & 0x1f;
1588+ const GLint rowCr0 = (rowC[j] >> 11) & 0x1f;
1589+ const GLint rowCr1 = (rowC[k] >> 11) & 0x1f;
1590+ const GLint rowDr0 = (rowD[j] >> 11) & 0x1f;
1591+ const GLint rowDr1 = (rowD[k] >> 11) & 0x1f;
1592+ const GLint rowAg0 = (rowA[j] >> 6) & 0x1f;
1593+ const GLint rowAg1 = (rowA[k] >> 6) & 0x1f;
1594+ const GLint rowBg0 = (rowB[j] >> 6) & 0x1f;
1595+ const GLint rowBg1 = (rowB[k] >> 6) & 0x1f;
1596+ const GLint rowCg0 = (rowC[j] >> 6) & 0x1f;
1597+ const GLint rowCg1 = (rowC[k] >> 6) & 0x1f;
1598+ const GLint rowDg0 = (rowD[j] >> 6) & 0x1f;
1599+ const GLint rowDg1 = (rowD[k] >> 6) & 0x1f;
1600+ const GLint rowAb0 = (rowA[j] >> 1) & 0x1f;
1601+ const GLint rowAb1 = (rowA[k] >> 1) & 0x1f;
1602+ const GLint rowBb0 = (rowB[j] >> 1) & 0x1f;
1603+ const GLint rowBb1 = (rowB[k] >> 1) & 0x1f;
1604+ const GLint rowCb0 = (rowC[j] >> 1) & 0x1f;
1605+ const GLint rowCb1 = (rowC[k] >> 1) & 0x1f;
1606+ const GLint rowDb0 = (rowD[j] >> 1) & 0x1f;
1607+ const GLint rowDb1 = (rowD[k] >> 1) & 0x1f;
1608+ const GLint rowAa0 = (rowA[j] & 0x1);
1609+ const GLint rowAa1 = (rowA[k] & 0x1);
1610+ const GLint rowBa0 = (rowB[j] & 0x1);
1611+ const GLint rowBa1 = (rowB[k] & 0x1);
1612+ const GLint rowCa0 = (rowC[j] & 0x1);
1613+ const GLint rowCa1 = (rowC[k] & 0x1);
1614+ const GLint rowDa0 = (rowD[j] & 0x1);
1615+ const GLint rowDa1 = (rowD[k] & 0x1);
1616+ const GLint r = FILTER_SUM_3D(rowAr0, rowAr1, rowBr0, rowBr1,
1617+ rowCr0, rowCr1, rowDr0, rowDr1);
1618+ const GLint g = FILTER_SUM_3D(rowAg0, rowAg1, rowBg0, rowBg1,
1619+ rowCg0, rowCg1, rowDg0, rowDg1);
1620+ const GLint b = FILTER_SUM_3D(rowAb0, rowAb1, rowBb0, rowBb1,
1621+ rowCb0, rowCb1, rowDb0, rowDb1);
1622+ const GLint a = FILTER_SUM_3D(rowAa0, rowAa1, rowBa0, rowBa1,
1623+ rowCa0, rowCa1, rowDa0, rowDa1);
1624+
1625+ dst[i] = (r << 11) | (g << 6) | (b << 1) | a;
1626+ }
1627+ }
1628 else if ((datatype == GL_UNSIGNED_BYTE_3_3_2) && (comps == 3)) {
1629 DECLARE_ROW_POINTERS0(GLushort);
1630
1631diff --git a/src/mesa/state_tracker/st_cb_eglimage.c b/src/mesa/state_tracker/st_cb_eglimage.c
1632index 3145416..c54baf4 100644
1633--- a/src/mesa/state_tracker/st_cb_eglimage.c
1634+++ b/src/mesa/state_tracker/st_cb_eglimage.c
1635@@ -129,6 +129,7 @@ st_bind_surface(GLcontext *ctx, GLenum target,
1636
1637 /* FIXME create a non-default sampler view from the pipe_surface? */
1638 pipe_resource_reference(&stObj->pt, ps->texture);
1639+ pipe_sampler_view_reference(&stObj->sampler_view, NULL);
1640 pipe_resource_reference(&stImage->pt, stObj->pt);
1641
1642 stObj->width0 = ps->width;
9caf779f
AM
1643diff --git a/src/mesa/state_tracker/st_manager.c b/src/mesa/state_tracker/st_manager.c
1644index 66e32b4..cd418a0 100644
1645--- a/src/mesa/state_tracker/st_manager.c
1646+++ b/src/mesa/state_tracker/st_manager.c
1647@@ -486,9 +486,18 @@ st_context_notify_invalid_framebuffer(struct st_context_iface *stctxi,
1648 stfb = st_ws_framebuffer(st->ctx->WinSysDrawBuffer);
1649 if (!stfb || stfb->iface != stfbi)
1650 stfb = st_ws_framebuffer(st->ctx->WinSysReadBuffer);
1651- assert(stfb && stfb->iface == stfbi);
1652
1653- p_atomic_set(&stfb->revalidate, TRUE);
1654+ if (stfb && stfb->iface == stfbi) {
1655+ p_atomic_set(&stfb->revalidate, TRUE);
1656+ }
1657+ else {
1658+ /* This function is probably getting called when we've detected a
1659+ * change in a window's size but the currently bound context is
1660+ * not bound to that window.
1661+ * If the st_framebuffer_iface structure had a pointer to the
1662+ * corresponding st_framebuffer we'd be able to handle this.
1663+ */
1664+ }
1665 }
1666
1667 static void
1668diff --git a/src/mesa/swrast/s_texfilter.c b/src/mesa/swrast/s_texfilter.c
1669index 3fc554c..198f0e2 100644
1670--- a/src/mesa/swrast/s_texfilter.c
1671+++ b/src/mesa/swrast/s_texfilter.c
1672@@ -2972,11 +2972,16 @@ choose_depth_texture_level(const struct gl_texture_object *tObj, GLfloat lambda)
1673 {
1674 GLint level;
1675
1676- lambda = CLAMP(lambda, tObj->MinLod, tObj->MaxLod);
1677-
1678- level = (GLint) lambda;
1679-
1680- level = CLAMP(level, tObj->BaseLevel, tObj->_MaxLevel);
1681+ if (tObj->MinFilter == GL_NEAREST || tObj->MinFilter == GL_LINEAR) {
1682+ /* no mipmapping - use base level */
1683+ level = tObj->BaseLevel;
1684+ }
1685+ else {
1686+ /* choose mipmap level */
1687+ lambda = CLAMP(lambda, tObj->MinLod, tObj->MaxLod);
1688+ level = (GLint) lambda;
1689+ level = CLAMP(level, tObj->BaseLevel, tObj->_MaxLevel);
1690+ }
1691
1692 return level;
1693 }
This page took 0.252548 seconds and 4 git commands to generate.