From 7a2af605c2c2b0d2e9bbb0b161eba8842acefbcb Mon Sep 17 00:00:00 2001
From: marha '$l'
The Mesa bug database is hosted on
@@ -50,5 +50,5 @@ If your bug report is vague or your test program doesn't compile
easily, the problem may not be fixed very quickly.
The SGI OpenGL conformance tests verify correct operation of OpenGL
diff --git a/mesalib/docs/contents.html b/mesalib/docs/contents.html
index 6f556eed9..e7a23a6bc 100644
--- a/mesalib/docs/contents.html
+++ b/mesalib/docs/contents.html
@@ -1,33 +1,35 @@
-
-
-
Normally Mesa (and OpenGL) records but does not notify the user of
@@ -34,5 +35,5 @@
src/dlist.c for details.
Both professional and volunteer developers contribute to Mesa.
diff --git a/mesalib/docs/devinfo.html b/mesalib/docs/devinfo.html
index 678e48c01..4828cc61d 100644
--- a/mesalib/docs/devinfo.html
+++ b/mesalib/docs/devinfo.html
@@ -1,15 +1,16 @@
-
+
+
+
To add a new GL extension to Mesa you have to do at least the following.
@@ -52,7 +53,7 @@ To add a new GL extension to Mesa you have to do at least the following.
-
Mesa's code style has changed over the years. Here's the latest.
@@ -148,20 +149,20 @@ src/mesa/state_tracker/st_glsl_to_tgsi.cpp can serve as examples.
These are the instructions for making a new Mesa release.
Use git to get the latest Mesa files from the git repository, from whatever
branch is relevant.
Create/edit the docs/relnotes-x.y.html file to document what's new in the release.
Add the new relnotes-x.y.html file to relnotes.html.
@@ -182,7 +183,10 @@ Update docs/news.html.
-Check in all updates to git.
+Create a docs/relnotes-x.y.z.html file.
+The bin/shortlog_mesa.sh script can be used to create a HTML-formatted list
+of changes to include in the file.
+Link the new docs/relnotes-x.y.z.html file into the main relnotes.html file.
@@ -192,7 +196,7 @@ Then:
Make the distribution files. From inside the Mesa directory:
'
+ in_log=1
+ elif echo "$l" | egrep -q '^$' ; then
+ echo '
'
+ echo
+ in_log=0
+ else
+ mesg=$(echo $l | sed 's/ (cherry picked from commit [0-9a-f]\+)//;s/\&/&/g;s/\</g;s/>/\>/g')
+ echo ' Compilation and Installation using Autoconf
@@ -209,7 +209,6 @@ options are 16- and 32-bit color channels, which will add the bit size
to the library name. For example,
--with-osmesa-bits=16
will create the libOSMesa16 library with a 16-bit color channel.
-
3. Library Options
diff --git a/mesalib/docs/banner.html b/mesalib/docs/banner.html
index 4f12c7ac6..2ec187bb9 100644
--- a/mesalib/docs/banner.html
+++ b/mesalib/docs/banner.html
@@ -1,27 +1,33 @@
-
-
+
+
- The
-Mesa 3D Graphics Library
+
+
+
+
+
+The Mesa 3D Graphics Library
+
diff --git a/mesalib/docs/bugs.html b/mesalib/docs/bugs.html
index fa7c484cd..c5ed16d42 100644
--- a/mesalib/docs/bugs.html
+++ b/mesalib/docs/bugs.html
@@ -1,13 +1,13 @@
-
-
+
+
+
+
+ Bug Database
+Bug Database
Conformance
+
+
+
+
+ Conformance
Developer Topics
@@ -96,9 +98,9 @@ a:visited {
Hosted by:
-
diff --git a/mesalib/docs/debugging.html b/mesalib/docs/debugging.html
index 2df62f56e..36d3634ba 100644
--- a/mesalib/docs/debugging.html
+++ b/mesalib/docs/debugging.html
@@ -1,12 +1,13 @@
-
+
+
+
+
+
+
Debugging Tips
+Debugging Tips
Developers
+
+
+
+
+ Developers
Development Notes
-
-
-
-Development Notes
-
-
-Adding Extentions
+Adding Extentions
Coding Style
+Coding Style
Making a New Mesa Release
+Making a New Mesa Release
Get latest source files
+Get latest source files
Verify and update version info
+Verify and update version info
git push origin mesa_X_Y
Make the tarballs
+Make the tarballs
@@ -210,7 +214,7 @@ Copy the distribution files to a temporary directory, unpack them,
compile everything, and run some demos to be sure everything works.
Follow the directions on SourceForge for creating a new "release" and uploading the tarballs. @@ -242,7 +246,5 @@ and mesa-announce@lists.freedesktop.org
- - diff --git a/mesalib/docs/dispatch.html b/mesalib/docs/dispatch.html index 620aecd74..e40b41a60 100644 --- a/mesalib/docs/dispatch.html +++ b/mesalib/docs/dispatch.html @@ -1,19 +1,20 @@ - - -Several factors combine to make efficient dispatch of OpenGL functions fairly complicated. This document attempts to explain some of the issues and introduce the reader to Mesa's implementation. Readers already familiar -with the issues around GL dispatch can safely skip ahead to the overview of Mesa's implementation.
+with the issues around GL dispatch can safely skip ahead to the overview of Mesa's implementation. -Every GL application has at least one object called a GL context. This object, which is an implicit parameter to ever GL function, stores all @@ -46,8 +47,7 @@ differnt GL context current. This means that poor old glVertex3fv has to know which GL context is current in the thread where it is being called.
- -Mesa uses two per-thread pointers. The first pointer stores the address of the context current in the thread, and the second pointer stores the @@ -75,7 +75,7 @@ table. void glVertex3f(GLfloat x, GLfloat y, GLfloat z) { const struct _glapi_table * const dispatch = GET_DISPATCH(); - + (*dispatch->Vertex3f)(x, y, z); }
A number of optimizations have been made over the years to diminish the performance hit imposed by GL dispatch. This section describes these optimizations. The benefits of each optimization and the situations where each can or cannot be used are listed.
-The vast majority of OpenGL applications use the API in a single threaded manner. That is, the application has only one thread that makes calls into @@ -131,7 +131,7 @@ the common case.
Starting with the 2.4.20 Linux kernel, each thread is allocated an area of per-thread, global storage. Variables can be put in this area using some @@ -161,7 +161,7 @@ extern __thread struct _glapi_table *_glapi_tls_Dispatch GLX_USE_TLS. Any platform capable of using TLS should use this as the default dispatch method.
-Many platforms has difficulty properly optimizing the tail-call in the dispatch stubs. Platforms like x86 that pass parameters on the stack seem @@ -170,7 +170,7 @@ routines are very short, and it is trivial to create optimal assembly language versions. The amount of optimization provided by using assembly stubs varies from platform to platform and application to application. However, by using the assembly stubs, many platforms can use an additional -space optimization (see below).
+space optimization (see below).The biggest hurdle to creating assembly stubs is handling the various ways that the dispatch table pointer can be accessed. There are four @@ -235,7 +235,7 @@ implementation of each function. This makes the assembly file considerably larger (e.g., 29,332 lines for glapi_x86-64.S versus 1,155 lines for glapi_x86.S) and causes simple changes to the function implementation to generate many lines of diffs. Since the assmebly files -are typically generated by scripts (see below), this +are typically generated by scripts (see below), this isn't a significant problem.
Once a new assembly file is created, it must be inserted in the build @@ -245,8 +245,7 @@ step is to add the correct #ifdef magic to src/mesa/glapi/glapi_dispatch.c to prevent the C version of the dispatch functions from being built.
- -To implement glXGetProcAddress, Mesa stores a table that associates function names with pointers to those functions. This table is @@ -265,8 +264,7 @@ dispatch stub.
src/mesa/glapi/glapi.c just before glprocs.h is included. - -Primary Mesa download site: @@ -20,7 +21,7 @@ When a new release is coming, release candidates (betas) may be found
-Mesa releases are available in three formats: .tar.bz2, .tar.gz, and .zip @@ -79,7 +80,7 @@ instructions.
-A package of Mark Kilgard's GLUT library is available @@ -98,5 +99,5 @@ were split off some time ago.
- - + + diff --git a/mesalib/docs/egl.html b/mesalib/docs/egl.html index 5b750070c..e374357c9 100644 --- a/mesalib/docs/egl.html +++ b/mesalib/docs/egl.html @@ -1,9 +1,10 @@ - - -Normally, no environment variables need to be set. Most of the environment @@ -15,7 +16,7 @@ sometimes be useful for debugging end-user issues.
-The following are only applicable to the Mesa Xlib software driver. -See the Xlib software driver page for details. +See the Xlib software driver page for details.
A number of extensions have been developed especially for Mesa. @@ -14,22 +15,21 @@ The specifications follow.
--Mesa is an open-source implementation of the OpenGL specification. +Mesa is an open-source implementation of the OpenGL specification. OpenGL is a programming library for writing interactive 3D applications. -See the OpenGL website for more +See the OpenGL website for more information.
@@ -89,6 +88,7 @@ Still, Mesa serves at least these purposes: Stand-alone Mesa is the original incarnation of Mesa. On systems running the X Window System it does all its rendering through the Xlib API: +
Alternately, Mesa acts as the core for a number of OpenGL hardware drivers
within the DRI (Direct Rendering Infrastructure):
@@ -176,44 +175,43 @@ popular and feature-complete.
-
-
-GLUT (OpenGL Utility Toolkit) is no longer in the separate MesaGLUT-x.y.z.tar.gz file. +GLUT (OpenGL Utility Toolkit) is no longer in the separate MesaGLUT-x.y.z.tar.gz file. If you don't already have GLUT installed, you should grab freeglut. -
+ --GLw (OpenGL widget library) is now available from a separate git repository. Unless you're using very old Xt/Motif applications with OpenGL, you shouldn't need it. -
+GLw (OpenGL widget library) is now available from a separate git repository. Unless you're using very old Xt/Motif applications with OpenGL, you shouldn't need it. + --On Linux-based systems you'll want to follow the -Linux ABI standard. Basically you'll want the following:
@@ -248,29 +246,28 @@ The GLUT header and library should go in the same directories.-If your DRI-based driver isn't working, go to the -DRI website for trouble-shooting information. +If your DRI-based driver isn't working, go to the +DRI website for trouble-shooting information.
@@ -338,10 +335,9 @@ may introduce rasterization artifacts; see the leading comments inFirst, join the Mesa3d-dev mailing list. @@ -397,6 +393,5 @@ In the mean time, a 3rd party plug-in library is available.
- diff --git a/mesalib/docs/games.html b/mesalib/docs/games.html index 82e3d09a4..eaa7f4073 100644 --- a/mesalib/docs/games.html +++ b/mesalib/docs/games.html @@ -1,13 +1,13 @@ - - -We can always use more help with the Mesa project. @@ -54,14 +55,14 @@ Then post a message to propose what you want to do, just to make sure there's no issues.
- +Anyone is welcome to contribute code to the Mesa project. By doing so, it's assumed that you agree to the code's licensing terms.
Finally: -
+
If you're using a fedora distro the following command should install all the needed dependencies: +
sudo yum install flex bison imake libtool xorg-x11-proto-devel libdrm-devel \ gcc-c++ xorg-x11-server-devel libXi-devel libXmu-devel libXdamage-devel git \ @@ -73,8 +71,7 @@ the needed dependencies: - --2. Building with autoconf (Linux/Unix/X11)
+2. Building with autoconf (Linux/Unix/X11)
The primary method to build Mesa on Unix systems is with autoconf. @@ -82,19 +79,20 @@ The primary method to build Mesa on Unix systems is with autoconf.
The general approach is the standard: +
./configure make sudo make install+But please read the detailed autoconf instructions for more details.
- -3. Building with SCons (Windows/Linux)
+3. Building with SCons (Windows/Linux)
To build Mesa with SCons on Linux or Windows do @@ -119,8 +117,8 @@ To build Mesa with SCons for Windows on Linux using the MinGW crosscompiler tool This will create:
-
- build/windows-x86-debug/mesa/drivers/windows/gdi/opengl32.dll — Mesa + swrast, binary compatible with Windows's opengl32.dll -
- build/windows-x86-debug/gallium/targets/libgl-gdi/opengl32.dll — Mesa + Gallium + softpipe, binary compatible with Windows's opengl32.dll +
- build/windows-x86-debug/mesa/drivers/windows/gdi/opengl32.dll — Mesa + swrast, binary compatible with Windows's opengl32.dll +
- build/windows-x86-debug/gallium/targets/libgl-gdi/opengl32.dll — Mesa + Gallium + softpipe, binary compatible with Windows's opengl32.dll
Put them all in the same directory to test them. @@ -128,23 +126,21 @@ Put them all in the same directory to test them. - -
4. Building for other systems
+4. Building for other systems
Documentation for other environments (some may be very out of date):
--
+- README.VMS - VMS -
- README.CYGWIN - Cygwin -
- README.WIN32 - Win32 -
+
- -- README.VMS - VMS +
- README.CYGWIN - Cygwin +
- README.WIN32 - Win32 +
5. Library Information
+5. Library Information
When compilation has finished, look in the top-level
- -lib/@@ -188,8 +184,7 @@ versions of libGL and device drivers.6. Building OpenGL programs with pkg-config
+6. Building OpenGL programs with pkg-config
Running
+ +make installwill install package configuration files diff --git a/mesalib/docs/intro.html b/mesalib/docs/intro.html index 303f5eb0f..ef04f357e 100644 --- a/mesalib/docs/intro.html +++ b/mesalib/docs/intro.html @@ -1,12 +1,13 @@ - + + +Mesa Introduction + + + -Mesa Introduction - - - - - -Introduction
+Introduction
Mesa is an open-source implementation of the @@ -30,7 +31,7 @@ systems. -
Project History
+Project History
The Mesa project was originally started by Brian Paul. @@ -156,7 +157,7 @@ of the OpenGL specification. -
Major Versions
+Major Versions
This is a summary of the major versions of Mesa. @@ -165,7 +166,7 @@ of the OpenGL specification is implemented.
-Version 8.x features
+Version 8.x features
Version 8.x of Mesa implements the OpenGL 3.0 API. The developers at Intel deserve a lot of credit for implementing most @@ -174,14 +175,14 @@ the i965 driver.
-Version 7.x features
+Version 7.x features
Version 7.x of Mesa implements the OpenGL 2.1 API. The main feature of OpenGL 2.x is the OpenGL Shading Language.
-Version 6.x features
+Version 6.x features
Version 6.x of Mesa implements the OpenGL 1.5 API with the following extensions incorporated as standard features: @@ -221,7 +222,7 @@ OpenGL specification
for more details. -Version 5.x features
+Version 5.x features
Version 5.x of Mesa implements the OpenGL 1.4 API with the following extensions incorporated as standard features: @@ -247,7 +248,7 @@ extensions incorporated as standard features: -
Version 4.x features
+Version 4.x features
Version 4.x of Mesa implements the OpenGL 1.3 API with the following @@ -266,7 +267,7 @@ extensions incorporated as standard features:
GL_ARB_transpose_matrix - - a scene-graph library - + + diff --git a/mesalib/docs/license.html b/mesalib/docs/license.html index 913dd4109..f0ac28ccf 100644 --- a/mesalib/docs/license.html +++ b/mesalib/docs/license.html @@ -1,12 +1,13 @@ - + + + + +Version 3.x features
+Version 3.x features
Version 3.x of Mesa implements the OpenGL 1.2 API with the following @@ -282,7 +283,7 @@ features: -
Version 2.x features
+Version 2.x features
Version 2.x of Mesa implements the OpenGL 1.1 API with the following features. diff --git a/mesalib/docs/libraries.html b/mesalib/docs/libraries.html index 1c425cf1b..e9db42790 100644 --- a/mesalib/docs/libraries.html +++ b/mesalib/docs/libraries.html @@ -1,12 +1,13 @@ - + + +
+ +Libraries and Toolkits + + + -Libraries and Toolkits - - - - - -Libraries and Toolkits
+Libraries and Toolkits
- Apprentice - free OpenInventor work-alike @@ -53,4 +54,5 @@ Open SG PLUS
License / Cppyright Information + + + -License / Cppyright Information - - - - - -Disclaimer
+Disclaimer
Mesa is a 3-D graphics library with an API which is very similar to @@ -34,7 +35,7 @@ target="_parent">Silicon Graphics Incorporated. -
License / Copyright Information
+License / Copyright Information
The Mesa distribution consists of several components. Different copyrights @@ -73,7 +74,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
When contributing to the Mesa project you must agree to the licensing terms @@ -83,7 +84,7 @@ and their respective licenses.
-Component Location License diff --git a/mesalib/docs/lists.html b/mesalib/docs/lists.html index 033b0b70a..d89bcffbd 100644 --- a/mesalib/docs/lists.html +++ b/mesalib/docs/lists.html @@ -1,38 +1,36 @@ - + + + + +Mesa Mailing Lists + + + -Mesa Mailing Lists - - - - - -Mailing Lists
+Mailing Lists
There are four Mesa 3D / DRI mailing lists:
mesa-users - intended for end-users of Mesa and DRI drivers. Newbie questions are OK, but please try the general OpenGL -resources and Mesa/DRI documentation first. +resources and Mesa/DRI documentation first.
mesa-dev - for Mesa, Gallium and DRI development -discussion. Not for beginners. +discussion. Not for beginners.
mesa-commit - relays git check-in messages (for developers). -In general, people should not post to this list. +In general, people should not post to this list.
mesa-announce - announcements of new Mesa -versions are sent to this list. Very low traffic. +versions are sent to this list. Very low traffic.
Here are some other OpenGL-related forums you might find useful: @@ -82,5 +80,5 @@ target="_parent">OpenGL discussion forums at www.opengl.org - - + + diff --git a/mesalib/docs/llvmpipe.html b/mesalib/docs/llvmpipe.html index bd9cc26f2..cf4512ffc 100644 --- a/mesalib/docs/llvmpipe.html +++ b/mesalib/docs/llvmpipe.html @@ -1,12 +1,13 @@ - + + +
+ +The Gallium llvmpipe driver is a software rasterizer that uses LLVM to @@ -24,19 +25,19 @@ It's the fastest software rasterizer for Mesa.
An x86 or amd64 processor; 64-bit mode recommended.
An x86 or amd64 processor; 64-bit mode recommended.Support for SSE2 is strongly encouraged. Support for SSSE3 and SSE4.1 will yield the most efficient code. The fewer features the CPU has the more - likely is that you run into underperforming, buggy, or incomplete code. + likely is that you run into underperforming, buggy, or incomplete code.
See /proc/cpuinfo to know what your CPU supports.
LLVM: version 2.9 recommended; 2.6 or later required.
- NOTE: LLVM 2.8 and earlier will not work on systems that support the +LLVM: version 2.9 recommended; 2.6 or later required.
+NOTE: LLVM 2.8 and earlier will not work on systems that support the Intel AVX extensions (e.g. Sandybridge). LLVM's code generator will fail when trying to emit AVX instructions. This was fixed in LLVM 2.9.
@@ -46,6 +47,7 @@ It's the fastest software rasterizer for Mesa.
aptitude install llvm-dev
+ For a RPM-based distribution do:
@@ -73,8 +75,6 @@ It's the fastest software rasterizer for Mesa.
- scons build=profileThis will ensure that frame pointers are used both in C and JIT functions, and @@ -164,7 +164,7 @@ Building will also create several unit tests in build/linux-???-debug/gallium/drivers/llvmpipe: - ++ scons build=profile <same-as-before>
If you want to use both Mesa and another OpenGL library in the same @@ -20,11 +21,11 @@ This results in all the Mesa functions being prefixed with To do this, recompile Mesa with the compiler flag -DUSE_MGL_NAMESPACE. Add the flag to CFLAGS in the configuration file which you want to use. For example: +
CFLAGS += -DUSE_MGL_NAMESPACE- - - + + diff --git a/mesalib/docs/modelers.html b/mesalib/docs/modelers.html index 2e90a5268..13a4603fa 100644 --- a/mesalib/docs/modelers.html +++ b/mesalib/docs/modelers.html @@ -1,12 +1,13 @@ - + + + + +
Thomas Hellström of Tungsten Graphics has written a whitepaper -describing the new DRI memory management system. +describing the new DRI memory management system.
The MD5 checksums are:
@@ -578,7 +577,7 @@ This release basically just fixes bugs since the 6.0. release. - fixed build problems on OpenBSD - omit CVS directories from tarballs - glGetTexImage(GL_COLOR_INDEX) was broken - - fixed an infinite loop in t&l module + - fixed an infinite loop in t&l module - silenced some valgrind warnings about using unitialized memory - fixed some compilation/link glitches on IRIX (Mike Stephens) - glBindProgram wasn't getting compiled into display lists @@ -600,6 +599,7 @@ This release basically just fixes bugs since the 6.0. release. - fragment program XPD instruction was incorrect - glGetMaterial() didn't work reliably+
The MD5 checksums are:
@@ -612,7 +612,6 @@ eff71d59c211825e949199852f5a2316 MesaDemos-6.0.1.zip-
@@ -639,7 +638,6 @@ and primarily just incorporates bug fixes. -
@@ -663,7 +661,7 @@ OpenGL 1.5 features.
New features:
- reorganized directory tree
- - GL_ARB_vertex/fragment_program extensions (Michal Krol & Karl Rasche)
+ - GL_ARB_vertex/fragment_program extensions (Michal Krol & Karl Rasche)
- GL_ATI_texture_env_combine3 extension (Ian Romanick)
- GL_SGI_texture_color_table extension (Eric Plante)
- GL_NV_fragment_program extension
@@ -699,7 +697,7 @@ OpenGL 1.5 features.
- glTexImage1/2/3D now allows width/height/depth = 0
- disable SPARC asm code on Linux (bug 852204)
-
+The MD5 checksums are:
@@ -731,7 +729,6 @@ a21be975589e8a2d1871b6bb7874fffa MesaDemos-5.0.2.zip-
@@ -766,7 +763,6 @@ Mesa 5.0.2 has been released. This is a stable, bug-fix release. -
@@ -780,7 +776,6 @@ holds the Mesa 5.0.x code which will be abandoned at some point.
-@@ -1175,8 +1170,8 @@ Here's what's new:
Known problems: - NURBS or evaluator surfaces inside display lists don't always work --
Mesa 3.4 has been released. Here's what's new since the 3.3 release:
New:
- optimized glDrawPixels for glPixelZoom(1,-1)
@@ -1204,8 +1199,8 @@ Here's what's new:
Changes:
- finished internal support for compressed textures for DRI
--
Mesa 3.2 has been released. Here's what's new since the beta release:
Bug fixes:
- fixed memcpy bugs in span.c
@@ -1220,78 +1215,69 @@ Here's what's new:
- use bcopy() optimizations on FreeBSD
- re-enabled the optimized persp_textured_triangle() function
--
I've just upload the Mesa 3.2 beta 1 files to SourceForge at http://sourceforge.net/project/filelist.php?group_id=3
3.2 (note even number) is a stabilization release of Mesa 3.1 meaning it's mainly just bug fixes.
-Here's what's changed: - -
Here's what's changed:
++ Bug fixes: + - mixed drawing of lines and bitmaps sometimes had wrong colors + - added missing glHintPGI() function + - fixed a polygon culling bug + - fixed bugs in gluPartialDisk() + - Z values in selection mode were wrong + - added missing tokens: + GL_SMOOTH_POINT_SIZE_RANGE + GL_SMOOTH_POINT_SIZE_GRANULARITY + GL_SMOOTH_LINE_WIDTH_RANGE + GL_SMOOTH_LINE_WIDTH_GRANULARITY + GL_ALIASED_POINT_SIZE_RANGE + GL_ALIASED_LINE_WIDTH_RANGE + - fixed glCopyPixels when copying from back to front buffer + - GL_EXT_compiled_vertex_array tokens had _SGI suffix instead of _EXT + - glDrawRangeElements(GL_LINES, 0, 1, 2, type, indices) was broken + - glDeleteTextures() didn't decrement reference count correctly + - GL_SRCA_ALPHA_SATURATE blend mode didn't work correctly + - Actual depth of transformation matrix stacks was off by one + - 24bpp visuals didn't address pixels correctly + - mipmap level of detail (lambda) calculation simplified, more accurate + - 101691 - Polygon clipping and GL_LINE + - 101928 - Polygon clipping and GL_LINE (same fix as above) + - 101808 - Non-glVertexArrays tristrip bug + - 101971 - find_last_3f on Dec OSF (worked around) + - 102369 - segv on dec osf (possibly a duplicate of the above) + - 102893 - orientations of modelview cause segfault + New: + - updated SVGA Linux driver + - added the MESA_FX_NO_SIGNALS env var, see docs/README.3DFX + - build libGLw.a (Xt/OpenGL drawing area widget) library by default + - changed -O2 to -O3 for a number of gcc configs + Changes: + - glXCopyContext's mask parameter is now unsigned long, per GLX spec +
Please report any problems with this release ASAP. Bugs should be filed on the
Mesa3D website at sourceforge.
After 3.2 is wrapped up I hope to release 3.3 beta 1 soon afterward.
-- Brian
--
A Slashdot interview with Brian about Mesa (questions submitted by Slashdot readers) can be found at http://slashdot.org/interviews/99/12/17/0927212.shtml.
--
Mesa 3.1 is released!
--
There appear to be two new files on the ftp site, MesaLib-3.1beta3.tar.gz and MesaDemos-3.1beta3.tar.gz, that seem to be... yes, I've just received confirmation from the beta center, they are indeed the THIRD beta release of Mesa 3.1! Happy Days. Happy Days. Thanks Keith Whitwell for preparing these for us during Brian's absence.
--
I'm pleased to announce that I've accepted a position with Precision Insight, Inc. effective October, 1999. I'll be leaving Avid Technology in September.
I've been working on Mesa in my spare time for over five years. With Precision @@ -1301,41 +1287,41 @@ and OpenGL on Linux.
my work will continue to be open sourced and available to any other programmers who may want to contribute to it, or use it for other projects or platformsPS: I'm going to be traveling until Sep 6 and won't be reading email until then.
--
Anonymous CVS access is back online so suck up all the bandwidth you can afford. Note that this is a new archive, so you will need to re-checkout the archive. That means don't cvs update from a previous download.
--
A report from the SIGGRAPH '99 Linux/OpenGL BOF meeting is now available.
-Brian
--
www.mesa3d.org is having technical problems due to hardware failures at VA Linux systems. The Mac pages, ftp, and CVS services aren't fully restored yet. Please be patient.
-Brian
--
RPMS of the nVidia RIVA server can be found at ftp://ftp.mesa3d.org/mesa/misc/nVidia/.
--
nVidia has released some Linux binaries for xfree86 3.3.3.1, along with the full source, which includes GLX acceleration based on Mesa 3.0. They can be downloaded from http://www.nvidia.com/Products.nsf/htmlmedia/software_drivers.html.
--
Beta 2 of Mesa 3.1 has been make available at ftp://ftp.mesa3d.org/mesa/beta/. If you are into the quake scene, you may want to try this out, as it contains some optimizations specifically in the Q3A rendering path. -
-
For those interested in the integration of Mesa into XFree86 4.0, Precision Insight has posted their lowlevel design documents at http://www.precisioninsight.com.
--
May 1999 - John Carmack of id Software, Inc. has made a donation of US$10,000 to the Mesa project to support its continuing development. Mesa is a free implementation of the OpenGL 3D graphics library and id's @@ -1356,33 +1342,27 @@ This donation from John/id is very generous. Keith and I are very grateful.-
-
John Carmack made an interesting .plan update yesterday: -
John Carmack made an interesting .plan update yesterday:
++ "I put together a document on optimizing OpenGL drivers for Q3 that + should be helpful to the various Linux 3D teams.-
+ http://www.quake3arena.com/news/glopt.html" +
-
Updated the Mesa contributors section and added links to RPM Mesa packages.
--
The new webpages are now online. Enjoy, and let me know if you find any errors. -
-
SGI releases its GLX source code.
--
www.mesa3d.org established
- - - +www.mesa3d.org established
The current version of the OpenVG state tracker implements OpenVG 1.1. diff --git a/mesalib/docs/osmesa.html b/mesalib/docs/osmesa.html index 525da4d42..2207641ed 100644 --- a/mesalib/docs/osmesa.html +++ b/mesalib/docs/osmesa.html @@ -1,12 +1,13 @@ - + + +
+ +@@ -19,7 +20,7 @@ One potential application is to use Mesa as an off-line, batch-style renderer.
-The OSMesa API provides three basic functions for making off-screen +The OSMesa API provides three basic functions for making off-screen renderings: OSMesaCreateContext(), OSMesaMakeCurrent(), and OSMesaDestroyContext(). See the Mesa/include/GL/osmesa.h header for more information about the API functions. @@ -31,7 +32,7 @@ directory.
-For some applications 8-bit color channels don't have sufficient @@ -84,5 +85,5 @@ the top-level Makefile. Send a patch to the Mesa developers too, if you're inclined.
- - + + diff --git a/mesalib/docs/perf.html b/mesalib/docs/perf.html index ee9c4b117..ec400c613 100644 --- a/mesalib/docs/perf.html +++ b/mesalib/docs/perf.html @@ -1,16 +1,17 @@ - + + + + +Performance tips for software rendering: -
+The Gallium drivers support user-defined image post-processing. @@ -25,7 +26,7 @@ Multiple filters can be used together.
-In general, precompiled Mesa libraries are not available. @@ -16,5 +17,5 @@ However, some Linux distros (such as Ubuntu) seem to closely track Mesa and often have the latest Mesa release available as an update.
- - + + diff --git a/mesalib/docs/relnotes-6.4.1.html b/mesalib/docs/relnotes-6.4.1.html index 3d6ff1c4f..c4451f84f 100644 --- a/mesalib/docs/relnotes-6.4.1.html +++ b/mesalib/docs/relnotes-6.4.1.html @@ -37,7 +37,7 @@ bd003bb4f981a4f91dee4c38644d4f3f MesaGLUT-6.4.1.tar.bz2minstall script to replace normal install program
Note that this version of Mesa does not use the GEM memory manager. The master branch of git uses GEM.
diff --git a/mesalib/docs/relnotes-7.10.1.html b/mesalib/docs/relnotes-7.10.1.html index ea605d966..134591e33 100644 --- a/mesalib/docs/relnotes-7.10.1.html +++ b/mesalib/docs/relnotes-7.10.1.html @@ -185,7 +185,7 @@ with in, out, attribute, and varying.Daniel Vetter (1):
Dylan Noblesmith (1):
Kurt Roeckx (2): diff --git a/mesalib/docs/relnotes.html b/mesalib/docs/relnotes.html index 1bc889a5b..e9d0a9132 100644 --- a/mesalib/docs/relnotes.html +++ b/mesalib/docs/relnotes.html @@ -1,94 +1,95 @@ - + + +
+ +The release notes summarize what's new or changed in each Mesa release.
-Versions of Mesa prior to 6.4 are summarized in the versions file and the following release notes.
-The master git repository is hosted on freedesktop.org.
@@ -33,8 +35,7 @@ target="_parent">Mesa demos and tests git repository. - -
To get the Mesa sources anonymously (read-only):
@@ -57,8 +58,7 @@ To get the Mesa sources anonymously (read-only):
-
-
Mesa developers need to first have an account on
@@ -92,7 +92,7 @@ Once your account is established:
-
If you're
@@ -113,8 +113,7 @@ Unix users don't need to set this option.
At any given time, there may be several active branches in Mesa's
@@ -132,7 +131,7 @@ Questions about branch status/activity should be posted to the
mesa3d-dev mailing list.
Otherwise, you have to say
to get the latest files before you start working.
@@ -170,6 +171,7 @@ Make your changes and use
git add <files to commit>
git commit
+
to get your changes ready to push back into the fd.o repository.
@@ -185,12 +187,13 @@ To avoid this,
git pull --rebase
git push
+
If you are familiar with CVS or similar system, this is similar to doing a
This page describes the features and status of Mesa's support for the
@@ -19,7 +20,7 @@ Contents
The MESA_GLSL environment variable can be set to a comma-separated
@@ -58,8 +57,7 @@ Example: export MESA_GLSL=dump,nopt
The GLSL compiler currently supports version 1.20 of the shading language.
@@ -76,8 +74,7 @@ Several GLSL extensions are also supported:
-
- XXX update this section
The stand-alone GLSL compiler program can be used to compile GLSL shaders
@@ -151,7 +145,7 @@ into low-level GPU code.
This tool is useful for:
-
+
The source code for Mesa's shading language compiler is in the
@@ -240,13 +231,11 @@ This option is only relevant if EmitHighLevelInstructions is set.
Developers working on the GLSL compiler should test frequently to avoid
@@ -264,5 +253,5 @@ tests GLSL features.
The Mesa demos repository also has some good GLSL tests.
-Doxygen
+Doxygen
is used to automatically
produce cross-referenced documentation from the Mesa source code.
Developer git Access
+Developer git Access
Windows Users
+Windows Users
-
-Development Branches
+Development Branches
Developer Git Tips
+Developer Git Tips
git pull origin master
each time you do a pull.
git pull
+ cvs update in order to update your source tree to
the current repository state, instead of the time you did the last update.
(CVS doesn't work like git in this respect, but this is easiest way
to explain it.)
-
+
In any case, your repository now looks like you made your changes after
all the other changes.
Science and Technical
+Science and Technical
Shading Language Support
+Shading Language Support
-
-
-Environment Variables
+Environment Variables
GLSL Version
+GLSL Version
Unsupported Features
+Unsupported Features
Implementation Notes
+Implementation Notes
Programming Hints
+Programming Hints
-
-Stand-alone GLSL Compiler
+Stand-alone GLSL Compiler
-
-
-
-Compiler Implementation
+Compiler Implementation
If set, instructions will be annoted with comments to help with debugging.
Extra NOP instructions will also be inserted.
-
-
+
-
-Compiler Validation
+Compiler Validation
Source Code Documentation
+Source Code Documentation
Copyright © 2002-2003 by Tungsten Graphics, Inc.,
Cedar Park, Texas. All Rights Reserved.
diff --git a/mesalib/docs/subset.html b/mesalib/docs/subset.html
index c706381e3..0ceb13666 100644
--- a/mesalib/docs/subset.html
+++ b/mesalib/docs/subset.html
@@ -1,12 +1,13 @@
-
+
+
+
In 2002/2003 Tungsten Graphics was contracted to develop a subset Mesa/Radeon @@ -20,5 +21,5 @@ The specification for this subset can be found here.
- - + + diff --git a/mesalib/docs/systems.html b/mesalib/docs/systems.html index 62a6e0b52..999975183 100644 --- a/mesalib/docs/systems.html +++ b/mesalib/docs/systems.html @@ -1,12 +1,13 @@ - + + + + +Mesa is primarily developed and used on Linux systems. @@ -47,14 +48,14 @@ Software drivers include: Additional driver information:
-This was an intermediate release for X.org which wasn't otherwise released.)
-@@ -186,13 +186,13 @@ OpenGL renderer string: Gallium 0.4 on SVGA3D; build: RELEASE; OpenGL version string: 2.1 Mesa 8.0 +
If you don't see this, try setting this environment variable:
export LIBGL_DEBUG=verbose+
then rerun glxinfo and examine the output for error messages.
- - diff --git a/mesalib/docs/webmaster.html b/mesalib/docs/webmaster.html index 16f4dc803..f9de714fd 100644 --- a/mesalib/docs/webmaster.html +++ b/mesalib/docs/webmaster.html @@ -1,17 +1,18 @@ - + + + + +If you have problems, edits or additions for this website send them to Brian -(brian.e.paul gmail.com)
diff --git a/mesalib/docs/xlibdriver.html b/mesalib/docs/xlibdriver.html index db03bc353..57b23789e 100644 --- a/mesalib/docs/xlibdriver.html +++ b/mesalib/docs/xlibdriver.html @@ -1,12 +1,13 @@ - + + +
+ +Mesa's Xlib driver provides an emulation of the GLX interface so that @@ -31,7 +32,7 @@ The unique features of the Xlib driver follows.
-Mesa supports RGB(A) rendering into almost any X visual type and depth.
@@ -68,7 +69,7 @@ Here are some examples: -Mesa can use either an X Pixmap or XImage as the back color buffer when in double-buffer mode. @@ -95,7 +96,7 @@ for your application.
-When using Mesa directly or with GLX, it's up to the application writer to create a window with an appropriate colormap. The GLUT @@ -116,7 +117,7 @@ significant.
-To compensate for the nonlinear relationship between pixel values and displayed intensities, there is a gamma correction feature in @@ -169,7 +170,7 @@ the Gamma FAQ
-Hardware overlay planes are supported by the Xlib driver. To determine if your X server has overlay support you can test for the @@ -180,7 +181,7 @@ SERVER_OVERLAY_VISUALS property: -
If you set the MESA_HPCR_CLEAR environment variable then dithering will be used when clearing the color buffer. This is only applicable @@ -189,7 +190,7 @@ This incurs a small performance penalty.
-The following MESA-specific extensions are implemented in the Xlib driver.
@@ -248,7 +249,7 @@ just before an X window is destroyed. For example: This extension was added in Mesa 2.0. -This extension adds the glXCopySubBufferMESA() function. It works like glXSwapBuffers() but only copies a sub-region of the window @@ -261,7 +262,7 @@ instead of the whole window. This extension was added in Mesa 2.6
-
MESA_RGB_VISUAL - specifies the X visual and depth for RGB mode (X only)
MESA_CI_VISUAL - specifies the X visual and depth for CI mode (X only)
diff --git a/mesalib/scons/gallium.py b/mesalib/scons/gallium.py
index 2fa80db88..ee91ca444 100644
--- a/mesalib/scons/gallium.py
+++ b/mesalib/scons/gallium.py
@@ -327,7 +327,8 @@ def generate(env):
#'-march=pentium4',
]
if distutils.version.LooseVersion(ccversion) >= distutils.version.LooseVersion('4.2') \
- and (platform != 'windows' or env['build'] == 'debug' or True):
+ and (platform != 'windows' or env['build'] == 'debug' or True) \
+ and platform != 'haiku':
# NOTE: We need to ensure stack is realigned given that we
# produce shared objects, and have no control over the stack
# alignment policy of the application. Therefore we need
@@ -346,6 +347,14 @@ def generate(env):
if platform in ['windows', 'darwin']:
# Workaround http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37216
ccflags += ['-fno-common']
+ if platform in ['haiku']:
+ # Make optimizations compatible with Pentium or higher on Haiku
+ ccflags += [
+ '-mstackrealign', # ensure stack is aligned
+ '-march=i586', # Haiku target is Pentium
+ '-mtune=i686', # use i686 where we can
+ '-mmmx' # use mmx math where we can
+ ]
if env['machine'] == 'x86_64':
ccflags += ['-m64']
if platform == 'darwin':
diff --git a/mesalib/src/gallium/auxiliary/util/u_blit.c b/mesalib/src/gallium/auxiliary/util/u_blit.c
index e5b97f720..9bd2ef52d 100644
--- a/mesalib/src/gallium/auxiliary/util/u_blit.c
+++ b/mesalib/src/gallium/auxiliary/util/u_blit.c
@@ -419,7 +419,7 @@ util_blit_pixels_writemask(struct blit_state *ctx,
dstX0, dstY0, dst->u.tex.first_layer,/* dest */
src_tex, src_level,
&src_box);
- return;
+ return;
}
if (dst_format == dst->format) {
@@ -444,6 +444,9 @@ util_blit_pixels_writemask(struct blit_state *ctx,
src_tex->target != PIPE_TEXTURE_2D &&
src_tex->target != PIPE_TEXTURE_RECT))
{
+ /* Make a temporary texture which contains a copy of the source pixels.
+ * Then we'll sample from the temporary texture.
+ */
struct pipe_resource texTemp;
struct pipe_resource *tex;
struct pipe_sampler_view sv_templ;
@@ -515,6 +518,7 @@ util_blit_pixels_writemask(struct blit_state *ctx,
pipe_resource_reference(&tex, NULL);
}
else {
+ /* Directly sample from the source resource/texture */
u_sampler_view_default_template(&sv_templ, src_tex, src_format);
sampler_view = pipe->create_sampler_view(pipe, src_tex, &sv_templ);
diff --git a/mesalib/src/glsl/TODO b/mesalib/src/glsl/TODO
index eb73fc2e8..bd077a856 100644
--- a/mesalib/src/glsl/TODO
+++ b/mesalib/src/glsl/TODO
@@ -6,9 +6,6 @@
constant index values. For others it is more complicated. Perhaps these
cases should be silently converted to uniforms?
-- Implement support for ir_binop_dot in opt_algebraic.cpp. Perform
- transformations such as "dot(v, vec3(0.0, 1.0, 0.0))" -> v.y.
-
- Track source locations throughout the IR. There are currently several
places where we cannot emit line numbers for errors (and currently emit 0:0)
because we've "lost" the line number information. This is particularly
diff --git a/mesalib/src/glsl/ir.cpp b/mesalib/src/glsl/ir.cpp
index 69954998b..f81bfd1ab 100644
--- a/mesalib/src/glsl/ir.cpp
+++ b/mesalib/src/glsl/ir.cpp
@@ -46,6 +46,11 @@ bool ir_rvalue::is_negative_one() const
return false;
}
+bool ir_rvalue::is_basis() const
+{
+ return false;
+}
+
/**
* Modify the swizzle make to move one component to another
*
@@ -1125,6 +1130,49 @@ ir_constant::is_negative_one() const
return true;
}
+bool
+ir_constant::is_basis() const
+{
+ if (!this->type->is_scalar() && !this->type->is_vector())
+ return false;
+
+ if (this->type->is_boolean())
+ return false;
+
+ unsigned ones = 0;
+ for (unsigned c = 0; c < this->type->vector_elements; c++) {
+ switch (this->type->base_type) {
+ case GLSL_TYPE_FLOAT:
+ if (this->value.f[c] == 1.0)
+ ones++;
+ else if (this->value.f[c] != 0.0)
+ return false;
+ break;
+ case GLSL_TYPE_INT:
+ if (this->value.i[c] == 1)
+ ones++;
+ else if (this->value.i[c] != 0)
+ return false;
+ break;
+ case GLSL_TYPE_UINT:
+ if (int(this->value.u[c]) == 1)
+ ones++;
+ else if (int(this->value.u[c]) != 0)
+ return false;
+ break;
+ default:
+ /* The only other base types are structures, arrays, samplers, and
+ * booleans. Samplers cannot be constants, and the others should
+ * have been filtered out above.
+ */
+ assert(!"Should not get here.");
+ return false;
+ }
+ }
+
+ return ones == 1;
+}
+
ir_loop::ir_loop()
{
this->ir_type = ir_type_loop;
diff --git a/mesalib/src/glsl/ir.h b/mesalib/src/glsl/ir.h
index a3f9f0588..55535b2f5 100644
--- a/mesalib/src/glsl/ir.h
+++ b/mesalib/src/glsl/ir.h
@@ -201,7 +201,8 @@ public:
* for vector and scalar types that have all elements set to the value
* zero (or \c false for booleans).
*
- * \sa ir_constant::has_value, ir_rvalue::is_one, ir_rvalue::is_negative_one
+ * \sa ir_constant::has_value, ir_rvalue::is_one, ir_rvalue::is_negative_one,
+ * ir_constant::is_basis
*/
virtual bool is_zero() const;
@@ -213,7 +214,8 @@ public:
* for vector and scalar types that have all elements set to the value
* one (or \c true for booleans).
*
- * \sa ir_constant::has_value, ir_rvalue::is_zero, ir_rvalue::is_negative_one
+ * \sa ir_constant::has_value, ir_rvalue::is_zero, ir_rvalue::is_negative_one,
+ * ir_constant::is_basis
*/
virtual bool is_one() const;
@@ -223,12 +225,27 @@ public:
* The base implementation of this function always returns \c false. The
* \c ir_constant class over-rides this function to return \c true \b only
* for vector and scalar types that have all elements set to the value
- * negative one. For boolean times, the result is always \c false.
+ * negative one. For boolean types, the result is always \c false.
*
* \sa ir_constant::has_value, ir_rvalue::is_zero, ir_rvalue::is_one
+ * ir_constant::is_basis
*/
virtual bool is_negative_one() const;
+ /**
+ * Determine if an r-value is a basis vector
+ *
+ * The base implementation of this function always returns \c false. The
+ * \c ir_constant class over-rides this function to return \c true \b only
+ * for vector and scalar types that have one element set to the value one,
+ * and the other elements set to the value zero. For boolean types, the
+ * result is always \c false.
+ *
+ * \sa ir_constant::has_value, ir_rvalue::is_zero, ir_rvalue::is_one,
+ * is_constant::is_negative_one
+ */
+ virtual bool is_basis() const;
+
/**
* Return a generic value of error_type.
@@ -1743,13 +1760,14 @@ public:
* Determine whether a constant has the same value as another constant
*
* \sa ir_constant::is_zero, ir_constant::is_one,
- * ir_constant::is_negative_one
+ * ir_constant::is_negative_one, ir_constant::is_basis
*/
bool has_value(const ir_constant *) const;
virtual bool is_zero() const;
virtual bool is_one() const;
virtual bool is_negative_one() const;
+ virtual bool is_basis() const;
/**
* Value of the constant.
diff --git a/mesalib/src/glsl/opt_algebraic.cpp b/mesalib/src/glsl/opt_algebraic.cpp
index d39761260..75948db16 100644
--- a/mesalib/src/glsl/opt_algebraic.cpp
+++ b/mesalib/src/glsl/opt_algebraic.cpp
@@ -84,6 +84,12 @@ is_vec_one(ir_constant *ir)
return (ir == NULL) ? false : ir->is_one();
}
+static inline bool
+is_vec_basis(ir_constant *ir)
+{
+ return (ir == NULL) ? false : ir->is_basis();
+}
+
static void
update_type(ir_expression *ir)
{
@@ -309,6 +315,31 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir)
}
break;
+ case ir_binop_dot:
+ if (is_vec_zero(op_const[0]) || is_vec_zero(op_const[1])) {
+ this->progress = true;
+ return ir_constant::zero(mem_ctx, ir->type);
+ }
+ if (is_vec_basis(op_const[0])) {
+ this->progress = true;
+ unsigned component = 0;
+ for (unsigned c = 0; c < op_const[0]->type->vector_elements; c++) {
+ if (op_const[0]->value.f[c] == 1.0)
+ component = c;
+ }
+ return new(mem_ctx) ir_swizzle(ir->operands[1], component, 0, 0, 0, 1);
+ }
+ if (is_vec_basis(op_const[1])) {
+ this->progress = true;
+ unsigned component = 0;
+ for (unsigned c = 0; c < op_const[1]->type->vector_elements; c++) {
+ if (op_const[1]->value.f[c] == 1.0)
+ component = c;
+ }
+ return new(mem_ctx) ir_swizzle(ir->operands[0], component, 0, 0, 0, 1);
+ }
+ break;
+
case ir_binop_logic_and:
/* FINISHME: Also simplify (a && a) to (a). */
if (is_vec_one(op_const[0])) {
diff --git a/mesalib/src/mapi/glapi/gen/ARB_texture_storage.xml b/mesalib/src/mapi/glapi/gen/ARB_texture_storage.xml
index 945467939..045913806 100644
--- a/mesalib/src/mapi/glapi/gen/ARB_texture_storage.xml
+++ b/mesalib/src/mapi/glapi/gen/ARB_texture_storage.xml
@@ -8,7 +8,7 @@
-
+
diff --git a/mesalib/src/mapi/glapi/gen/GL3x.xml b/mesalib/src/mapi/glapi/gen/GL3x.xml
index ab4900c3e..f3d782ca4 100644
--- a/mesalib/src/mapi/glapi/gen/GL3x.xml
+++ b/mesalib/src/mapi/glapi/gen/GL3x.xml
@@ -32,6 +32,8 @@
+
+
@@ -474,8 +476,41 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -583,6 +618,11 @@
+
+
+
+
+
diff --git a/mesalib/src/mapi/glapi/gen/gl_API.xml b/mesalib/src/mapi/glapi/gen/gl_API.xml
index a74577d1f..4bd0fc6b2 100644
--- a/mesalib/src/mapi/glapi/gen/gl_API.xml
+++ b/mesalib/src/mapi/glapi/gen/gl_API.xml
@@ -7965,7 +7965,12 @@
-
+
+
+
+
+
+
@@ -8614,37 +8619,37 @@
-
+
-
+
-
+
-
+
-
+
-
+
@@ -8787,6 +8792,15 @@
+
+
+
+
+
+
+
+
+
@@ -9381,6 +9395,9 @@
+
+
+
@@ -10003,7 +10020,7 @@
-
+
@@ -10522,11 +10539,11 @@
-
+
-
+
@@ -10534,31 +10551,31 @@
-
+
-
+
-
+
-
+
-
+
@@ -10568,7 +10585,7 @@
-
+
@@ -10582,7 +10599,7 @@
-
+
@@ -10590,7 +10607,7 @@
-
+
@@ -10599,7 +10616,7 @@
-
+
@@ -10608,7 +10625,7 @@
-
+
@@ -10616,7 +10633,7 @@
-
+
@@ -10624,14 +10641,14 @@
-
+
-
+
@@ -10654,7 +10671,7 @@
-
+
@@ -10988,43 +11005,43 @@
-
+
-
+
-
+
-
+
-
+
-
+
-
+
@@ -11776,6 +11793,117 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -12030,6 +12158,13 @@
+
+
+
+
+
+
+
@@ -12236,8 +12371,19 @@
+
+
+
+
+
+
+
+
+
+
+
@@ -12264,12 +12410,12 @@
-
+
-
+
@@ -12279,6 +12425,12 @@
+
+
+
+
+
+
diff --git a/mesalib/src/mesa/Makefile b/mesalib/src/mesa/Makefile
index 845b524e6..b0b461fdd 100644
--- a/mesalib/src/mesa/Makefile
+++ b/mesalib/src/mesa/Makefile
@@ -135,7 +135,7 @@ asm_subdirs:
######################################################################
# Dependency generation
-depend: $(ALL_FILES)
+depend: $(ALL_FILES) main/git_sha1.h
@ echo "running $(MKDEP)"
@ touch depend
@$(MKDEP) $(MKDEP_OPTIONS) $(MESA_CPPFLAGS) \
diff --git a/mesalib/src/mesa/drivers/common/meta.c b/mesalib/src/mesa/drivers/common/meta.c
index 8d7e90126..be7141a58 100644
--- a/mesalib/src/mesa/drivers/common/meta.c
+++ b/mesalib/src/mesa/drivers/common/meta.c
@@ -319,6 +319,10 @@ struct gl_meta_state
struct drawtex_state DrawTex; /**< For _mesa_meta_DrawTex() */
};
+static void meta_glsl_blit_cleanup(struct gl_context *ctx, struct blit_state *blit);
+static void cleanup_temp_texture(struct gl_context *ctx, struct temp_texture *tex);
+static void meta_glsl_clear_cleanup(struct gl_context *ctx, struct clear_state *clear);
+
static GLuint
compile_shader_with_debug(struct gl_context *ctx, GLenum target, const GLcharARB *source)
{
@@ -335,12 +339,16 @@ compile_shader_with_debug(struct gl_context *ctx, GLenum target, const GLcharARB
return shader;
_mesa_GetShaderiv(shader, GL_INFO_LOG_LENGTH, &size);
- if (size == 0)
+ if (size == 0) {
+ _mesa_DeleteObjectARB(shader);
return 0;
+ }
info = malloc(size);
- if (!info)
+ if (!info) {
+ _mesa_DeleteObjectARB(shader);
return 0;
+ }
_mesa_GetProgramInfoLog(shader, size, NULL, info);
_mesa_problem(ctx,
@@ -349,6 +357,7 @@ compile_shader_with_debug(struct gl_context *ctx, GLenum target, const GLcharARB
info, source);
free(info);
+ _mesa_DeleteObjectARB(shader);
return 0;
}
@@ -401,10 +410,15 @@ _mesa_meta_init(struct gl_context *ctx)
void
_mesa_meta_free(struct gl_context *ctx)
{
- /* Note: Any textures, VBOs, etc, that we allocate should get
- * freed by the normal context destruction code. But this would be
- * the place to free other meta data someday.
- */
+ GET_CURRENT_CONTEXT(old_context);
+ _mesa_make_current(ctx, NULL, NULL);
+ meta_glsl_blit_cleanup(ctx, &ctx->Meta->Blit);
+ meta_glsl_clear_cleanup(ctx, &ctx->Meta->Clear);
+ cleanup_temp_texture(ctx, &ctx->Meta->TempTex);
+ if (old_context)
+ _mesa_make_current(old_context, old_context->WinSysDrawBuffer, old_context->WinSysReadBuffer);
+ else
+ _mesa_make_current(NULL, NULL, NULL);
free(ctx->Meta);
ctx->Meta = NULL;
}
@@ -1068,6 +1082,15 @@ init_temp_texture(struct gl_context *ctx, struct temp_texture *tex)
_mesa_GenTextures(1, &tex->TexObj);
}
+static void
+cleanup_temp_texture(struct gl_context *ctx, struct temp_texture *tex)
+{
+ if (!tex->TexObj)
+ return;
+ _mesa_DeleteTextures(1, &tex->TexObj);
+ tex->TexObj = 0;
+}
+
/**
* Return pointer to temp_texture info for non-bitmap ops.
@@ -1604,6 +1627,21 @@ _mesa_meta_BlitFramebuffer(struct gl_context *ctx,
}
}
+static void
+meta_glsl_blit_cleanup(struct gl_context *ctx, struct blit_state *blit)
+{
+ if (blit->ArrayObj) {
+ _mesa_DeleteVertexArraysAPPLE(1, &blit->ArrayObj);
+ blit->ArrayObj = 0;
+ _mesa_DeleteBuffersARB(1, &blit->VBO);
+ blit->VBO = 0;
+ }
+ if (blit->DepthFP) {
+ _mesa_DeletePrograms(1, &blit->DepthFP);
+ blit->DepthFP = 0;
+ }
+}
+
/**
* Meta implementation of ctx->Driver.Clear() in terms of polygon rendering.
@@ -1786,7 +1824,9 @@ meta_glsl_clear_init(struct gl_context *ctx, struct clear_state *clear)
clear->ShaderProg = _mesa_CreateProgramObjectARB();
_mesa_AttachShader(clear->ShaderProg, fs);
+ _mesa_DeleteObjectARB(fs);
_mesa_AttachShader(clear->ShaderProg, vs);
+ _mesa_DeleteObjectARB(vs);
_mesa_BindAttribLocationARB(clear->ShaderProg, 0, "position");
_mesa_LinkProgramARB(clear->ShaderProg);
@@ -1799,7 +1839,9 @@ meta_glsl_clear_init(struct gl_context *ctx, struct clear_state *clear)
clear->IntegerShaderProg = _mesa_CreateProgramObjectARB();
_mesa_AttachShader(clear->IntegerShaderProg, fs);
+ _mesa_DeleteObjectARB(fs);
_mesa_AttachShader(clear->IntegerShaderProg, vs);
+ _mesa_DeleteObjectARB(vs);
_mesa_BindAttribLocationARB(clear->IntegerShaderProg, 0, "position");
/* Note that user-defined out attributes get automatically assigned
@@ -1814,6 +1856,24 @@ meta_glsl_clear_init(struct gl_context *ctx, struct clear_state *clear)
}
}
+static void
+meta_glsl_clear_cleanup(struct gl_context *ctx, struct clear_state *clear)
+{
+ if (clear->ArrayObj == 0)
+ return;
+ _mesa_DeleteVertexArraysAPPLE(1, &clear->ArrayObj);
+ clear->ArrayObj = 0;
+ _mesa_DeleteBuffersARB(1, &clear->VBO);
+ clear->VBO = 0;
+ _mesa_DeleteObjectARB(clear->ShaderProg);
+ clear->ShaderProg = 0;
+
+ if (clear->IntegerShaderProg) {
+ _mesa_DeleteObjectARB(clear->IntegerShaderProg);
+ clear->IntegerShaderProg = 0;
+ }
+}
+
/**
* Meta implementation of ctx->Driver.Clear() in terms of polygon rendering.
*/
diff --git a/mesalib/src/mesa/drivers/windows/gdi/mesa.def b/mesalib/src/mesa/drivers/windows/gdi/mesa.def
index d5c98801d..fec7bbac0 100644
--- a/mesalib/src/mesa/drivers/windows/gdi/mesa.def
+++ b/mesalib/src/mesa/drivers/windows/gdi/mesa.def
@@ -556,21 +556,6 @@ EXPORTS
glFogCoorddvEXT
glFogCoordPointerEXT
glBlendFuncSeparateEXT
- glFlushVertexArrayRangeNV
- glVertexArrayRangeNV
- glCombinerParameterfvNV
- glCombinerParameterfNV
- glCombinerParameterivNV
- glCombinerParameteriNV
- glCombinerInputNV
- glCombinerOutputNV
- glFinalCombinerInputNV
- glGetCombinerInputParameterfvNV
- glGetCombinerInputParameterivNV
- glGetCombinerOutputParameterfvNV
- glGetCombinerOutputParameterivNV
- glGetFinalCombinerInputParameterfvNV
- glGetFinalCombinerInputParameterivNV
glResizeBuffersMESA
glWindowPos2dMESA
glWindowPos2dvMESA
diff --git a/mesalib/src/mesa/main/shaderobj.c b/mesalib/src/mesa/main/shaderobj.c
index 7eb6f0bda..16800ae5e 100644
--- a/mesalib/src/mesa/main/shaderobj.c
+++ b/mesalib/src/mesa/main/shaderobj.c
@@ -278,7 +278,9 @@ _mesa_clear_shader_program_data(struct gl_context *ctx,
struct gl_shader_program *shProg)
{
if (shProg->UniformStorage) {
- _mesa_uniform_detach_all_driver_storage(shProg->UniformStorage);
+ unsigned i;
+ for (i = 0; i < shProg->NumUserUniformStorage; ++i)
+ _mesa_uniform_detach_all_driver_storage(&shProg->UniformStorage[i]);
ralloc_free(shProg->UniformStorage);
shProg->NumUserUniformStorage = 0;
shProg->UniformStorage = NULL;
diff --git a/mesalib/src/mesa/program/hash_table.c b/mesalib/src/mesa/program/hash_table.c
index dc8563a33..7dabadc50 100644
--- a/mesalib/src/mesa/program/hash_table.c
+++ b/mesalib/src/mesa/program/hash_table.c
@@ -149,7 +149,7 @@ hash_table_insert(struct hash_table *ht, void *data, const void *key)
insert_at_head(& ht->buckets[bucket], & node->link);
}
-void
+bool
hash_table_replace(struct hash_table *ht, void *data, const void *key)
{
const unsigned hash_value = (*ht->hash)(key);
@@ -162,7 +162,7 @@ hash_table_replace(struct hash_table *ht, void *data, const void *key)
if ((*ht->compare)(hn->key, key) == 0) {
hn->data = data;
- return;
+ return true;
}
}
@@ -172,6 +172,7 @@ hash_table_replace(struct hash_table *ht, void *data, const void *key)
hn->key = key;
insert_at_head(& ht->buckets[bucket], & hn->link);
+ return false;
}
void
diff --git a/mesalib/src/mesa/program/hash_table.h b/mesalib/src/mesa/program/hash_table.h
index bcf65df7d..e95fc4982 100644
--- a/mesalib/src/mesa/program/hash_table.h
+++ b/mesalib/src/mesa/program/hash_table.h
@@ -32,6 +32,7 @@
#define HASH_TABLE_H
#include
+#include
#include
#include
#include
@@ -114,6 +115,10 @@ extern void hash_table_insert(struct hash_table *ht, void *data,
/**
* Add an element to a hash table with replacement
*
+ * \return
+ * 1 if it did replace the the value (in which case the old key is kept), 0 if
+ * it did not replace the value (in which case the new key is kept).
+ *
* \warning
* If \c key is already in the hash table, \c data will \b replace the most
* recently inserted \c data (see the warning in \c hash_table_insert) for
@@ -121,7 +126,7 @@ extern void hash_table_insert(struct hash_table *ht, void *data,
*
* \sa hash_table_insert
*/
-extern void hash_table_replace(struct hash_table *ht, void *data,
+extern bool hash_table_replace(struct hash_table *ht, void *data,
const void *key);
/**
@@ -219,6 +224,7 @@ public:
*/
void clear()
{
+ hash_table_call_foreach(this->ht, delete_key, NULL);
hash_table_clear(this->ht);
}
@@ -258,9 +264,12 @@ public:
* because UINT_MAX+1 = 0.
*/
assert(value != UINT_MAX);
- hash_table_replace(this->ht,
- (void *) (intptr_t) (value + 1),
- strdup(key));
+ char *dup_key = strdup(key);
+ bool result = hash_table_replace(this->ht,
+ (void *) (intptr_t) (value + 1),
+ dup_key);
+ if (result)
+ free(dup_key);
}
private:
diff --git a/mesalib/src/mesa/sources.mak b/mesalib/src/mesa/sources.mak
index 608aa79ab..16b1c39c0 100644
--- a/mesalib/src/mesa/sources.mak
+++ b/mesalib/src/mesa/sources.mak
@@ -198,6 +198,7 @@ VBO_FILES = \
STATETRACKER_FILES = \
$(SRCDIR)/state_tracker/st_atom.c \
+ $(SRCDIR)/state_tracker/st_atom_array.c \
$(SRCDIR)/state_tracker/st_atom_blend.c \
$(SRCDIR)/state_tracker/st_atom_clip.c \
$(SRCDIR)/state_tracker/st_atom_constbuf.c \
diff --git a/mesalib/src/mesa/state_tracker/st_atom.c b/mesalib/src/mesa/state_tracker/st_atom.c
index d9cd4aab4..e6fc114f1 100644
--- a/mesalib/src/mesa/state_tracker/st_atom.c
+++ b/mesalib/src/mesa/state_tracker/st_atom.c
@@ -63,7 +63,10 @@ static const struct st_tracked_state *atoms[] =
&st_update_vs_constants,
&st_update_gs_constants,
&st_update_fs_constants,
- &st_update_pixel_transfer
+ &st_update_pixel_transfer,
+
+ /* this must be done after the vertex program update */
+ &st_update_array
};
@@ -122,6 +125,22 @@ static void check_program_state( struct st_context *st )
st->dirty.st |= ST_NEW_GEOMETRY_PROGRAM;
}
+static void check_attrib_edgeflag(struct st_context *st)
+{
+ const struct gl_client_array **arrays = st->ctx->Array._DrawArrays;
+ GLboolean vertDataEdgeFlags;
+
+ if (!arrays)
+ return;
+
+ vertDataEdgeFlags = arrays[VERT_ATTRIB_EDGEFLAG]->BufferObj &&
+ arrays[VERT_ATTRIB_EDGEFLAG]->BufferObj->Name;
+ if (vertDataEdgeFlags != st->vertdata_edgeflags) {
+ st->vertdata_edgeflags = vertDataEdgeFlags;
+ st->dirty.st |= ST_NEW_EDGEFLAGS_DATA;
+ }
+}
+
/***********************************************************************
* Update all derived state:
@@ -132,6 +151,12 @@ void st_validate_state( struct st_context *st )
struct st_state_flags *state = &st->dirty;
GLuint i;
+ /* Get Mesa driver state. */
+ st->dirty.st |= st->ctx->NewDriverState;
+ st->ctx->NewDriverState = 0;
+
+ check_attrib_edgeflag(st);
+
/* The bitmap cache is immune to pixel unpack changes.
* Note that GLUT makes several calls to glPixelStore for each
* bitmap char it draws so this is an important check.
diff --git a/mesalib/src/mesa/state_tracker/st_atom.h b/mesalib/src/mesa/state_tracker/st_atom.h
index 930a08444..703bc2ab3 100644
--- a/mesalib/src/mesa/state_tracker/st_atom.h
+++ b/mesalib/src/mesa/state_tracker/st_atom.h
@@ -46,6 +46,7 @@ void st_destroy_atoms( struct st_context *st );
void st_validate_state( struct st_context *st );
+extern const struct st_tracked_state st_update_array;
extern const struct st_tracked_state st_update_framebuffer;
extern const struct st_tracked_state st_update_clip;
extern const struct st_tracked_state st_update_depth_stencil_alpha;
@@ -70,4 +71,8 @@ extern const struct st_tracked_state st_update_pixel_transfer;
GLuint st_compare_func_to_pipe(GLenum func);
+enum pipe_format
+st_pipe_vertex_format(GLenum type, GLuint size, GLenum format,
+ GLboolean normalized, GLboolean integer);
+
#endif
diff --git a/mesalib/src/mesa/state_tracker/st_atom_array.c b/mesalib/src/mesa/state_tracker/st_atom_array.c
new file mode 100644
index 000000000..d60b0d7a9
--- /dev/null
+++ b/mesalib/src/mesa/state_tracker/st_atom_array.c
@@ -0,0 +1,588 @@
+/**************************************************************************
+ *
+ * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
+ * Copyright 2012 Marek Olšák
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+/*
+ * This converts the VBO's vertex attribute/array information into
+ * Gallium vertex state and binds it.
+ *
+ * Authors:
+ * Keith Whitwell
+ * Marek Olšák
+ */
+
+#include "st_context.h"
+#include "st_atom.h"
+#include "st_cb_bufferobjects.h"
+#include "st_draw.h"
+#include "st_program.h"
+
+#include "cso_cache/cso_context.h"
+#include "util/u_math.h"
+
+#include "main/bufferobj.h"
+#include "main/image.h"
+
+
+static GLuint double_types[4] = {
+ PIPE_FORMAT_R64_FLOAT,
+ PIPE_FORMAT_R64G64_FLOAT,
+ PIPE_FORMAT_R64G64B64_FLOAT,
+ PIPE_FORMAT_R64G64B64A64_FLOAT
+};
+
+static GLuint float_types[4] = {
+ PIPE_FORMAT_R32_FLOAT,
+ PIPE_FORMAT_R32G32_FLOAT,
+ PIPE_FORMAT_R32G32B32_FLOAT,
+ PIPE_FORMAT_R32G32B32A32_FLOAT
+};
+
+static GLuint half_float_types[4] = {
+ PIPE_FORMAT_R16_FLOAT,
+ PIPE_FORMAT_R16G16_FLOAT,
+ PIPE_FORMAT_R16G16B16_FLOAT,
+ PIPE_FORMAT_R16G16B16A16_FLOAT
+};
+
+static GLuint uint_types_norm[4] = {
+ PIPE_FORMAT_R32_UNORM,
+ PIPE_FORMAT_R32G32_UNORM,
+ PIPE_FORMAT_R32G32B32_UNORM,
+ PIPE_FORMAT_R32G32B32A32_UNORM
+};
+
+static GLuint uint_types_scale[4] = {
+ PIPE_FORMAT_R32_USCALED,
+ PIPE_FORMAT_R32G32_USCALED,
+ PIPE_FORMAT_R32G32B32_USCALED,
+ PIPE_FORMAT_R32G32B32A32_USCALED
+};
+
+static GLuint uint_types_int[4] = {
+ PIPE_FORMAT_R32_UINT,
+ PIPE_FORMAT_R32G32_UINT,
+ PIPE_FORMAT_R32G32B32_UINT,
+ PIPE_FORMAT_R32G32B32A32_UINT
+};
+
+static GLuint int_types_norm[4] = {
+ PIPE_FORMAT_R32_SNORM,
+ PIPE_FORMAT_R32G32_SNORM,
+ PIPE_FORMAT_R32G32B32_SNORM,
+ PIPE_FORMAT_R32G32B32A32_SNORM
+};
+
+static GLuint int_types_scale[4] = {
+ PIPE_FORMAT_R32_SSCALED,
+ PIPE_FORMAT_R32G32_SSCALED,
+ PIPE_FORMAT_R32G32B32_SSCALED,
+ PIPE_FORMAT_R32G32B32A32_SSCALED
+};
+
+static GLuint int_types_int[4] = {
+ PIPE_FORMAT_R32_SINT,
+ PIPE_FORMAT_R32G32_SINT,
+ PIPE_FORMAT_R32G32B32_SINT,
+ PIPE_FORMAT_R32G32B32A32_SINT
+};
+
+static GLuint ushort_types_norm[4] = {
+ PIPE_FORMAT_R16_UNORM,
+ PIPE_FORMAT_R16G16_UNORM,
+ PIPE_FORMAT_R16G16B16_UNORM,
+ PIPE_FORMAT_R16G16B16A16_UNORM
+};
+
+static GLuint ushort_types_scale[4] = {
+ PIPE_FORMAT_R16_USCALED,
+ PIPE_FORMAT_R16G16_USCALED,
+ PIPE_FORMAT_R16G16B16_USCALED,
+ PIPE_FORMAT_R16G16B16A16_USCALED
+};
+
+static GLuint ushort_types_int[4] = {
+ PIPE_FORMAT_R16_UINT,
+ PIPE_FORMAT_R16G16_UINT,
+ PIPE_FORMAT_R16G16B16_UINT,
+ PIPE_FORMAT_R16G16B16A16_UINT
+};
+
+static GLuint short_types_norm[4] = {
+ PIPE_FORMAT_R16_SNORM,
+ PIPE_FORMAT_R16G16_SNORM,
+ PIPE_FORMAT_R16G16B16_SNORM,
+ PIPE_FORMAT_R16G16B16A16_SNORM
+};
+
+static GLuint short_types_scale[4] = {
+ PIPE_FORMAT_R16_SSCALED,
+ PIPE_FORMAT_R16G16_SSCALED,
+ PIPE_FORMAT_R16G16B16_SSCALED,
+ PIPE_FORMAT_R16G16B16A16_SSCALED
+};
+
+static GLuint short_types_int[4] = {
+ PIPE_FORMAT_R16_SINT,
+ PIPE_FORMAT_R16G16_SINT,
+ PIPE_FORMAT_R16G16B16_SINT,
+ PIPE_FORMAT_R16G16B16A16_SINT
+};
+
+static GLuint ubyte_types_norm[4] = {
+ PIPE_FORMAT_R8_UNORM,
+ PIPE_FORMAT_R8G8_UNORM,
+ PIPE_FORMAT_R8G8B8_UNORM,
+ PIPE_FORMAT_R8G8B8A8_UNORM
+};
+
+static GLuint ubyte_types_scale[4] = {
+ PIPE_FORMAT_R8_USCALED,
+ PIPE_FORMAT_R8G8_USCALED,
+ PIPE_FORMAT_R8G8B8_USCALED,
+ PIPE_FORMAT_R8G8B8A8_USCALED
+};
+
+static GLuint ubyte_types_int[4] = {
+ PIPE_FORMAT_R8_UINT,
+ PIPE_FORMAT_R8G8_UINT,
+ PIPE_FORMAT_R8G8B8_UINT,
+ PIPE_FORMAT_R8G8B8A8_UINT
+};
+
+static GLuint byte_types_norm[4] = {
+ PIPE_FORMAT_R8_SNORM,
+ PIPE_FORMAT_R8G8_SNORM,
+ PIPE_FORMAT_R8G8B8_SNORM,
+ PIPE_FORMAT_R8G8B8A8_SNORM
+};
+
+static GLuint byte_types_scale[4] = {
+ PIPE_FORMAT_R8_SSCALED,
+ PIPE_FORMAT_R8G8_SSCALED,
+ PIPE_FORMAT_R8G8B8_SSCALED,
+ PIPE_FORMAT_R8G8B8A8_SSCALED
+};
+
+static GLuint byte_types_int[4] = {
+ PIPE_FORMAT_R8_SINT,
+ PIPE_FORMAT_R8G8_SINT,
+ PIPE_FORMAT_R8G8B8_SINT,
+ PIPE_FORMAT_R8G8B8A8_SINT
+};
+
+static GLuint fixed_types[4] = {
+ PIPE_FORMAT_R32_FIXED,
+ PIPE_FORMAT_R32G32_FIXED,
+ PIPE_FORMAT_R32G32B32_FIXED,
+ PIPE_FORMAT_R32G32B32A32_FIXED
+};
+
+
+/**
+ * Return a PIPE_FORMAT_x for the given GL datatype and size.
+ */
+enum pipe_format
+st_pipe_vertex_format(GLenum type, GLuint size, GLenum format,
+ GLboolean normalized, GLboolean integer)
+{
+ assert((type >= GL_BYTE && type <= GL_DOUBLE) ||
+ type == GL_FIXED || type == GL_HALF_FLOAT ||
+ type == GL_INT_2_10_10_10_REV ||
+ type == GL_UNSIGNED_INT_2_10_10_10_REV);
+ assert(size >= 1);
+ assert(size <= 4);
+ assert(format == GL_RGBA || format == GL_BGRA);
+
+ if (type == GL_INT_2_10_10_10_REV ||
+ type == GL_UNSIGNED_INT_2_10_10_10_REV) {
+ assert(size == 4);
+ assert(!integer);
+
+ if (format == GL_BGRA) {
+ if (type == GL_INT_2_10_10_10_REV) {
+ if (normalized)
+ return PIPE_FORMAT_B10G10R10A2_SNORM;
+ else
+ return PIPE_FORMAT_B10G10R10A2_SSCALED;
+ } else {
+ if (normalized)
+ return PIPE_FORMAT_B10G10R10A2_UNORM;
+ else
+ return PIPE_FORMAT_B10G10R10A2_USCALED;
+ }
+ } else {
+ if (type == GL_INT_2_10_10_10_REV) {
+ if (normalized)
+ return PIPE_FORMAT_R10G10B10A2_SNORM;
+ else
+ return PIPE_FORMAT_R10G10B10A2_SSCALED;
+ } else {
+ if (normalized)
+ return PIPE_FORMAT_R10G10B10A2_UNORM;
+ else
+ return PIPE_FORMAT_R10G10B10A2_USCALED;
+ }
+ }
+ }
+
+ if (format == GL_BGRA) {
+ /* this is an odd-ball case */
+ assert(type == GL_UNSIGNED_BYTE);
+ assert(normalized);
+ return PIPE_FORMAT_B8G8R8A8_UNORM;
+ }
+
+ if (integer) {
+ switch (type) {
+ case GL_INT: return int_types_int[size-1];
+ case GL_SHORT: return short_types_int[size-1];
+ case GL_BYTE: return byte_types_int[size-1];
+ case GL_UNSIGNED_INT: return uint_types_int[size-1];
+ case GL_UNSIGNED_SHORT: return ushort_types_int[size-1];
+ case GL_UNSIGNED_BYTE: return ubyte_types_int[size-1];
+ default: assert(0); return 0;
+ }
+ }
+ else if (normalized) {
+ switch (type) {
+ case GL_DOUBLE: return double_types[size-1];
+ case GL_FLOAT: return float_types[size-1];
+ case GL_HALF_FLOAT: return half_float_types[size-1];
+ case GL_INT: return int_types_norm[size-1];
+ case GL_SHORT: return short_types_norm[size-1];
+ case GL_BYTE: return byte_types_norm[size-1];
+ case GL_UNSIGNED_INT: return uint_types_norm[size-1];
+ case GL_UNSIGNED_SHORT: return ushort_types_norm[size-1];
+ case GL_UNSIGNED_BYTE: return ubyte_types_norm[size-1];
+ case GL_FIXED: return fixed_types[size-1];
+ default: assert(0); return 0;
+ }
+ }
+ else {
+ switch (type) {
+ case GL_DOUBLE: return double_types[size-1];
+ case GL_FLOAT: return float_types[size-1];
+ case GL_HALF_FLOAT: return half_float_types[size-1];
+ case GL_INT: return int_types_scale[size-1];
+ case GL_SHORT: return short_types_scale[size-1];
+ case GL_BYTE: return byte_types_scale[size-1];
+ case GL_UNSIGNED_INT: return uint_types_scale[size-1];
+ case GL_UNSIGNED_SHORT: return ushort_types_scale[size-1];
+ case GL_UNSIGNED_BYTE: return ubyte_types_scale[size-1];
+ case GL_FIXED: return fixed_types[size-1];
+ default: assert(0); return 0;
+ }
+ }
+ return PIPE_FORMAT_NONE; /* silence compiler warning */
+}
+
+/**
+ * Examine the active arrays to determine if we have interleaved
+ * vertex arrays all living in one VBO, or all living in user space.
+ */
+static GLboolean
+is_interleaved_arrays(const struct st_vertex_program *vp,
+ const struct st_vp_variant *vpv,
+ const struct gl_client_array **arrays)
+{
+ GLuint attr;
+ const struct gl_buffer_object *firstBufObj = NULL;
+ GLint firstStride = -1;
+ const GLubyte *firstPtr = NULL;
+ GLboolean userSpaceBuffer = GL_FALSE;
+
+ for (attr = 0; attr < vpv->num_inputs; attr++) {
+ const GLuint mesaAttr = vp->index_to_input[attr];
+ const struct gl_client_array *array = arrays[mesaAttr];
+ const struct gl_buffer_object *bufObj = array->BufferObj;
+ const GLsizei stride = array->StrideB; /* in bytes */
+
+ if (attr == 0) {
+ /* save info about the first array */
+ firstStride = stride;
+ firstPtr = array->Ptr;
+ firstBufObj = bufObj;
+ userSpaceBuffer = !bufObj || !bufObj->Name;
+ }
+ else {
+ /* check if other arrays interleave with the first, in same buffer */
+ if (stride != firstStride)
+ return GL_FALSE; /* strides don't match */
+
+ if (bufObj != firstBufObj)
+ return GL_FALSE; /* arrays in different VBOs */
+
+ if (abs(array->Ptr - firstPtr) > firstStride)
+ return GL_FALSE; /* arrays start too far apart */
+
+ if ((!_mesa_is_bufferobj(bufObj)) != userSpaceBuffer)
+ return GL_FALSE; /* mix of VBO and user-space arrays */
+ }
+ }
+
+ return GL_TRUE;
+}
+
+/**
+ * Set up for drawing interleaved arrays that all live in one VBO
+ * or all live in user space.
+ * \param vbuffer returns vertex buffer info
+ * \param velements returns vertex element info
+ */
+static boolean
+setup_interleaved_attribs(const struct st_vertex_program *vp,
+ const struct st_vp_variant *vpv,
+ const struct gl_client_array **arrays,
+ struct pipe_vertex_buffer *vbuffer,
+ struct pipe_vertex_element velements[])
+{
+ GLuint attr;
+ const GLubyte *low_addr = NULL;
+ GLboolean usingVBO; /* all arrays in a VBO? */
+ struct gl_buffer_object *bufobj;
+ GLsizei stride;
+
+ /* Find the lowest address of the arrays we're drawing,
+ * Init bufobj and stride.
+ */
+ if (vpv->num_inputs) {
+ const GLuint mesaAttr0 = vp->index_to_input[0];
+ const struct gl_client_array *array = arrays[mesaAttr0];
+
+ /* Since we're doing interleaved arrays, we know there'll be at most
+ * one buffer object and the stride will be the same for all arrays.
+ * Grab them now.
+ */
+ bufobj = array->BufferObj;
+ stride = array->StrideB;
+
+ low_addr = arrays[vp->index_to_input[0]]->Ptr;
+
+ for (attr = 1; attr < vpv->num_inputs; attr++) {
+ const GLubyte *start = arrays[vp->index_to_input[attr]]->Ptr;
+ low_addr = MIN2(low_addr, start);
+ }
+ }
+ else {
+ /* not sure we'll ever have zero inputs, but play it safe */
+ bufobj = NULL;
+ stride = 0;
+ low_addr = 0;
+ }
+
+ /* are the arrays in user space? */
+ usingVBO = _mesa_is_bufferobj(bufobj);
+
+ for (attr = 0; attr < vpv->num_inputs; attr++) {
+ const GLuint mesaAttr = vp->index_to_input[attr];
+ const struct gl_client_array *array = arrays[mesaAttr];
+ unsigned src_offset = (unsigned) (array->Ptr - low_addr);
+ GLuint element_size = array->_ElementSize;
+
+ assert(element_size == array->Size * _mesa_sizeof_type(array->Type));
+
+ velements[attr].src_offset = src_offset;
+ velements[attr].instance_divisor = array->InstanceDivisor;
+ velements[attr].vertex_buffer_index = 0;
+ velements[attr].src_format = st_pipe_vertex_format(array->Type,
+ array->Size,
+ array->Format,
+ array->Normalized,
+ array->Integer);
+ assert(velements[attr].src_format);
+ }
+
+ /*
+ * Return the vbuffer info and setup user-space attrib info, if needed.
+ */
+ if (vpv->num_inputs == 0) {
+ /* just defensive coding here */
+ vbuffer->buffer = NULL;
+ vbuffer->user_buffer = NULL;
+ vbuffer->buffer_offset = 0;
+ vbuffer->stride = 0;
+ }
+ else if (usingVBO) {
+ /* all interleaved arrays in a VBO */
+ struct st_buffer_object *stobj = st_buffer_object(bufobj);
+
+ if (!stobj || !stobj->buffer) {
+ return FALSE; /* out-of-memory error probably */
+ }
+
+ vbuffer->buffer = stobj->buffer;
+ vbuffer->user_buffer = NULL;
+ vbuffer->buffer_offset = pointer_to_offset(low_addr);
+ vbuffer->stride = stride;
+ }
+ else {
+ /* all interleaved arrays in user memory */
+ vbuffer->buffer = NULL;
+ vbuffer->user_buffer = low_addr;
+ vbuffer->buffer_offset = 0;
+ vbuffer->stride = stride;
+ }
+ return TRUE;
+}
+
+/**
+ * Set up a separate pipe_vertex_buffer and pipe_vertex_element for each
+ * vertex attribute.
+ * \param vbuffer returns vertex buffer info
+ * \param velements returns vertex element info
+ */
+static boolean
+setup_non_interleaved_attribs(struct st_context *st,
+ const struct st_vertex_program *vp,
+ const struct st_vp_variant *vpv,
+ const struct gl_client_array **arrays,
+ struct pipe_vertex_buffer vbuffer[],
+ struct pipe_vertex_element velements[])
+{
+ struct gl_context *ctx = st->ctx;
+ GLuint attr;
+
+ for (attr = 0; attr < vpv->num_inputs; attr++) {
+ const GLuint mesaAttr = vp->index_to_input[attr];
+ const struct gl_client_array *array = arrays[mesaAttr];
+ struct gl_buffer_object *bufobj = array->BufferObj;
+ GLsizei stride = array->StrideB;
+
+ assert(array->_ElementSize == array->Size * _mesa_sizeof_type(array->Type));
+
+ if (_mesa_is_bufferobj(bufobj)) {
+ /* Attribute data is in a VBO.
+ * Recall that for VBOs, the gl_client_array->Ptr field is
+ * really an offset from the start of the VBO, not a pointer.
+ */
+ struct st_buffer_object *stobj = st_buffer_object(bufobj);
+
+ if (!stobj || !stobj->buffer) {
+ return FALSE; /* out-of-memory error probably */
+ }
+
+ vbuffer[attr].buffer = stobj->buffer;
+ vbuffer[attr].user_buffer = NULL;
+ vbuffer[attr].buffer_offset = pointer_to_offset(array->Ptr);
+ }
+ else {
+ /* wrap user data */
+ void *ptr;
+
+ if (array->Ptr) {
+ ptr = (void *) array->Ptr;
+ }
+ else {
+ /* no array, use ctx->Current.Attrib[] value */
+ ptr = (void *) ctx->Current.Attrib[mesaAttr];
+ stride = 0;
+ }
+
+ assert(ptr);
+
+ vbuffer[attr].buffer = NULL;
+ vbuffer[attr].user_buffer = ptr;
+ vbuffer[attr].buffer_offset = 0;
+ }
+
+ /* common-case setup */
+ vbuffer[attr].stride = stride; /* in bytes */
+
+ velements[attr].src_offset = 0;
+ velements[attr].instance_divisor = array->InstanceDivisor;
+ velements[attr].vertex_buffer_index = attr;
+ velements[attr].src_format = st_pipe_vertex_format(array->Type,
+ array->Size,
+ array->Format,
+ array->Normalized,
+ array->Integer);
+ assert(velements[attr].src_format);
+ }
+ return TRUE;
+}
+
+static void update_array(struct st_context *st)
+{
+ struct gl_context *ctx = st->ctx;
+ const struct gl_client_array **arrays = ctx->Array._DrawArrays;
+ const struct st_vertex_program *vp;
+ const struct st_vp_variant *vpv;
+ struct pipe_vertex_buffer vbuffer[PIPE_MAX_SHADER_INPUTS];
+ struct pipe_vertex_element velements[PIPE_MAX_ATTRIBS];
+ unsigned num_vbuffers, num_velements;
+
+ st->vertex_array_out_of_memory = FALSE;
+
+ /* No drawing has been done yet, so do nothing. */
+ if (!arrays)
+ return;
+
+ /* vertex program validation must be done before this */
+ vp = st->vp;
+ vpv = st->vp_variant;
+
+ memset(velements, 0, sizeof(struct pipe_vertex_element) * vpv->num_inputs);
+
+ /*
+ * Setup the vbuffer[] and velements[] arrays.
+ */
+ if (is_interleaved_arrays(vp, vpv, arrays)) {
+ if (!setup_interleaved_attribs(vp, vpv, arrays, vbuffer, velements)) {
+ st->vertex_array_out_of_memory = TRUE;
+ return;
+ }
+
+ num_vbuffers = 1;
+ num_velements = vpv->num_inputs;
+ if (num_velements == 0)
+ num_vbuffers = 0;
+ }
+ else {
+ if (!setup_non_interleaved_attribs(st, vp, vpv, arrays, vbuffer,
+ velements)) {
+ st->vertex_array_out_of_memory = TRUE;
+ return;
+ }
+
+ num_vbuffers = vpv->num_inputs;
+ num_velements = vpv->num_inputs;
+ }
+
+ cso_set_vertex_buffers(st->cso_context, num_vbuffers, vbuffer);
+ cso_set_vertex_elements(st->cso_context, num_velements, velements);
+}
+
+
+const struct st_tracked_state st_update_array = {
+ "st_update_array", /* name */
+ { /* dirty */
+ (_NEW_PROGRAM | _NEW_BUFFER_OBJECT), /* mesa */
+ ST_NEW_VERTEX_ARRAYS | ST_NEW_VERTEX_PROGRAM, /* st */
+ },
+ update_array /* update */
+};
diff --git a/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c b/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c
index 9a3f22465..d3f8d1368 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c
@@ -217,7 +217,7 @@ st_make_drawpix_z_stencil_program(struct st_context *st,
if (!p)
return NULL;
- p->NumInstructions = write_depth ? 2 : 1;
+ p->NumInstructions = write_depth ? 3 : 1;
p->NumInstructions += write_stencil ? 1 : 0;
p->Instructions = _mesa_alloc_instructions(p->NumInstructions);
@@ -238,6 +238,13 @@ st_make_drawpix_z_stencil_program(struct st_context *st,
p->Instructions[ic].TexSrcUnit = 0;
p->Instructions[ic].TexSrcTarget = TEXTURE_2D_INDEX;
ic++;
+ /* MOV result.color, fragment.color; */
+ p->Instructions[ic].Opcode = OPCODE_MOV;
+ p->Instructions[ic].DstReg.File = PROGRAM_OUTPUT;
+ p->Instructions[ic].DstReg.Index = FRAG_RESULT_COLOR;
+ p->Instructions[ic].SrcReg[0].File = PROGRAM_INPUT;
+ p->Instructions[ic].SrcReg[0].Index = FRAG_ATTRIB_COL0;
+ ic++;
}
if (write_stencil) {
@@ -260,8 +267,10 @@ st_make_drawpix_z_stencil_program(struct st_context *st,
p->InputsRead = FRAG_BIT_TEX0 | FRAG_BIT_COL0;
p->OutputsWritten = 0;
- if (write_depth)
+ if (write_depth) {
p->OutputsWritten |= BITFIELD64_BIT(FRAG_RESULT_DEPTH);
+ p->OutputsWritten |= BITFIELD64_BIT(FRAG_RESULT_COLOR);
+ }
if (write_stencil)
p->OutputsWritten |= BITFIELD64_BIT(FRAG_RESULT_STENCIL);
diff --git a/mesalib/src/mesa/state_tracker/st_context.h b/mesalib/src/mesa/state_tracker/st_context.h
index 55ae65b3c..734b4d9c1 100644
--- a/mesalib/src/mesa/state_tracker/st_context.h
+++ b/mesalib/src/mesa/state_tracker/st_context.h
@@ -88,6 +88,8 @@ struct st_context
*/
boolean invalidate_on_gl_viewport;
+ boolean vertex_array_out_of_memory;
+
/* Some state is contained in constant objects.
* Other state is just parameter values.
*/
diff --git a/mesalib/src/mesa/state_tracker/st_draw.c b/mesalib/src/mesa/state_tracker/st_draw.c
index 0a06e9995..db8caa566 100644
--- a/mesalib/src/mesa/state_tracker/st_draw.c
+++ b/mesalib/src/mesa/state_tracker/st_draw.c
@@ -31,10 +31,6 @@
* this function whether the user called glBegin/End, glDrawArrays,
* glDrawElements, glEvalMesh, or glCalList, etc.
*
- * We basically convert the VBO's vertex attribute/array information into
- * Gallium vertex state, bind the vertex buffer objects and call
- * pipe->draw_vbo().
- *
* Authors:
* Keith Whitwell
*/
@@ -68,261 +64,6 @@
#include "../glsl/ir_uniform.h"
-static GLuint double_types[4] = {
- PIPE_FORMAT_R64_FLOAT,
- PIPE_FORMAT_R64G64_FLOAT,
- PIPE_FORMAT_R64G64B64_FLOAT,
- PIPE_FORMAT_R64G64B64A64_FLOAT
-};
-
-static GLuint float_types[4] = {
- PIPE_FORMAT_R32_FLOAT,
- PIPE_FORMAT_R32G32_FLOAT,
- PIPE_FORMAT_R32G32B32_FLOAT,
- PIPE_FORMAT_R32G32B32A32_FLOAT
-};
-
-static GLuint half_float_types[4] = {
- PIPE_FORMAT_R16_FLOAT,
- PIPE_FORMAT_R16G16_FLOAT,
- PIPE_FORMAT_R16G16B16_FLOAT,
- PIPE_FORMAT_R16G16B16A16_FLOAT
-};
-
-static GLuint uint_types_norm[4] = {
- PIPE_FORMAT_R32_UNORM,
- PIPE_FORMAT_R32G32_UNORM,
- PIPE_FORMAT_R32G32B32_UNORM,
- PIPE_FORMAT_R32G32B32A32_UNORM
-};
-
-static GLuint uint_types_scale[4] = {
- PIPE_FORMAT_R32_USCALED,
- PIPE_FORMAT_R32G32_USCALED,
- PIPE_FORMAT_R32G32B32_USCALED,
- PIPE_FORMAT_R32G32B32A32_USCALED
-};
-
-static GLuint uint_types_int[4] = {
- PIPE_FORMAT_R32_UINT,
- PIPE_FORMAT_R32G32_UINT,
- PIPE_FORMAT_R32G32B32_UINT,
- PIPE_FORMAT_R32G32B32A32_UINT
-};
-
-static GLuint int_types_norm[4] = {
- PIPE_FORMAT_R32_SNORM,
- PIPE_FORMAT_R32G32_SNORM,
- PIPE_FORMAT_R32G32B32_SNORM,
- PIPE_FORMAT_R32G32B32A32_SNORM
-};
-
-static GLuint int_types_scale[4] = {
- PIPE_FORMAT_R32_SSCALED,
- PIPE_FORMAT_R32G32_SSCALED,
- PIPE_FORMAT_R32G32B32_SSCALED,
- PIPE_FORMAT_R32G32B32A32_SSCALED
-};
-
-static GLuint int_types_int[4] = {
- PIPE_FORMAT_R32_SINT,
- PIPE_FORMAT_R32G32_SINT,
- PIPE_FORMAT_R32G32B32_SINT,
- PIPE_FORMAT_R32G32B32A32_SINT
-};
-
-static GLuint ushort_types_norm[4] = {
- PIPE_FORMAT_R16_UNORM,
- PIPE_FORMAT_R16G16_UNORM,
- PIPE_FORMAT_R16G16B16_UNORM,
- PIPE_FORMAT_R16G16B16A16_UNORM
-};
-
-static GLuint ushort_types_scale[4] = {
- PIPE_FORMAT_R16_USCALED,
- PIPE_FORMAT_R16G16_USCALED,
- PIPE_FORMAT_R16G16B16_USCALED,
- PIPE_FORMAT_R16G16B16A16_USCALED
-};
-
-static GLuint ushort_types_int[4] = {
- PIPE_FORMAT_R16_UINT,
- PIPE_FORMAT_R16G16_UINT,
- PIPE_FORMAT_R16G16B16_UINT,
- PIPE_FORMAT_R16G16B16A16_UINT
-};
-
-static GLuint short_types_norm[4] = {
- PIPE_FORMAT_R16_SNORM,
- PIPE_FORMAT_R16G16_SNORM,
- PIPE_FORMAT_R16G16B16_SNORM,
- PIPE_FORMAT_R16G16B16A16_SNORM
-};
-
-static GLuint short_types_scale[4] = {
- PIPE_FORMAT_R16_SSCALED,
- PIPE_FORMAT_R16G16_SSCALED,
- PIPE_FORMAT_R16G16B16_SSCALED,
- PIPE_FORMAT_R16G16B16A16_SSCALED
-};
-
-static GLuint short_types_int[4] = {
- PIPE_FORMAT_R16_SINT,
- PIPE_FORMAT_R16G16_SINT,
- PIPE_FORMAT_R16G16B16_SINT,
- PIPE_FORMAT_R16G16B16A16_SINT
-};
-
-static GLuint ubyte_types_norm[4] = {
- PIPE_FORMAT_R8_UNORM,
- PIPE_FORMAT_R8G8_UNORM,
- PIPE_FORMAT_R8G8B8_UNORM,
- PIPE_FORMAT_R8G8B8A8_UNORM
-};
-
-static GLuint ubyte_types_scale[4] = {
- PIPE_FORMAT_R8_USCALED,
- PIPE_FORMAT_R8G8_USCALED,
- PIPE_FORMAT_R8G8B8_USCALED,
- PIPE_FORMAT_R8G8B8A8_USCALED
-};
-
-static GLuint ubyte_types_int[4] = {
- PIPE_FORMAT_R8_UINT,
- PIPE_FORMAT_R8G8_UINT,
- PIPE_FORMAT_R8G8B8_UINT,
- PIPE_FORMAT_R8G8B8A8_UINT
-};
-
-static GLuint byte_types_norm[4] = {
- PIPE_FORMAT_R8_SNORM,
- PIPE_FORMAT_R8G8_SNORM,
- PIPE_FORMAT_R8G8B8_SNORM,
- PIPE_FORMAT_R8G8B8A8_SNORM
-};
-
-static GLuint byte_types_scale[4] = {
- PIPE_FORMAT_R8_SSCALED,
- PIPE_FORMAT_R8G8_SSCALED,
- PIPE_FORMAT_R8G8B8_SSCALED,
- PIPE_FORMAT_R8G8B8A8_SSCALED
-};
-
-static GLuint byte_types_int[4] = {
- PIPE_FORMAT_R8_SINT,
- PIPE_FORMAT_R8G8_SINT,
- PIPE_FORMAT_R8G8B8_SINT,
- PIPE_FORMAT_R8G8B8A8_SINT
-};
-
-static GLuint fixed_types[4] = {
- PIPE_FORMAT_R32_FIXED,
- PIPE_FORMAT_R32G32_FIXED,
- PIPE_FORMAT_R32G32B32_FIXED,
- PIPE_FORMAT_R32G32B32A32_FIXED
-};
-
-
-
-/**
- * Return a PIPE_FORMAT_x for the given GL datatype and size.
- */
-enum pipe_format
-st_pipe_vertex_format(GLenum type, GLuint size, GLenum format,
- GLboolean normalized, GLboolean integer)
-{
- assert((type >= GL_BYTE && type <= GL_DOUBLE) ||
- type == GL_FIXED || type == GL_HALF_FLOAT ||
- type == GL_INT_2_10_10_10_REV ||
- type == GL_UNSIGNED_INT_2_10_10_10_REV);
- assert(size >= 1);
- assert(size <= 4);
- assert(format == GL_RGBA || format == GL_BGRA);
-
- if (type == GL_INT_2_10_10_10_REV ||
- type == GL_UNSIGNED_INT_2_10_10_10_REV) {
- assert(size == 4);
- assert(!integer);
-
- if (format == GL_BGRA) {
- if (type == GL_INT_2_10_10_10_REV) {
- if (normalized)
- return PIPE_FORMAT_B10G10R10A2_SNORM;
- else
- return PIPE_FORMAT_B10G10R10A2_SSCALED;
- } else {
- if (normalized)
- return PIPE_FORMAT_B10G10R10A2_UNORM;
- else
- return PIPE_FORMAT_B10G10R10A2_USCALED;
- }
- } else {
- if (type == GL_INT_2_10_10_10_REV) {
- if (normalized)
- return PIPE_FORMAT_R10G10B10A2_SNORM;
- else
- return PIPE_FORMAT_R10G10B10A2_SSCALED;
- } else {
- if (normalized)
- return PIPE_FORMAT_R10G10B10A2_UNORM;
- else
- return PIPE_FORMAT_R10G10B10A2_USCALED;
- }
- }
- }
-
- if (format == GL_BGRA) {
- /* this is an odd-ball case */
- assert(type == GL_UNSIGNED_BYTE);
- assert(normalized);
- return PIPE_FORMAT_B8G8R8A8_UNORM;
- }
-
- if (integer) {
- switch (type) {
- case GL_INT: return int_types_int[size-1];
- case GL_SHORT: return short_types_int[size-1];
- case GL_BYTE: return byte_types_int[size-1];
- case GL_UNSIGNED_INT: return uint_types_int[size-1];
- case GL_UNSIGNED_SHORT: return ushort_types_int[size-1];
- case GL_UNSIGNED_BYTE: return ubyte_types_int[size-1];
- default: assert(0); return 0;
- }
- }
- else if (normalized) {
- switch (type) {
- case GL_DOUBLE: return double_types[size-1];
- case GL_FLOAT: return float_types[size-1];
- case GL_HALF_FLOAT: return half_float_types[size-1];
- case GL_INT: return int_types_norm[size-1];
- case GL_SHORT: return short_types_norm[size-1];
- case GL_BYTE: return byte_types_norm[size-1];
- case GL_UNSIGNED_INT: return uint_types_norm[size-1];
- case GL_UNSIGNED_SHORT: return ushort_types_norm[size-1];
- case GL_UNSIGNED_BYTE: return ubyte_types_norm[size-1];
- case GL_FIXED: return fixed_types[size-1];
- default: assert(0); return 0;
- }
- }
- else {
- switch (type) {
- case GL_DOUBLE: return double_types[size-1];
- case GL_FLOAT: return float_types[size-1];
- case GL_HALF_FLOAT: return half_float_types[size-1];
- case GL_INT: return int_types_scale[size-1];
- case GL_SHORT: return short_types_scale[size-1];
- case GL_BYTE: return byte_types_scale[size-1];
- case GL_UNSIGNED_INT: return uint_types_scale[size-1];
- case GL_UNSIGNED_SHORT: return ushort_types_scale[size-1];
- case GL_UNSIGNED_BYTE: return ubyte_types_scale[size-1];
- case GL_FIXED: return fixed_types[size-1];
- default: assert(0); return 0;
- }
- }
- return PIPE_FORMAT_NONE; /* silence compiler warning */
-}
-
-
/**
* This is very similar to vbo_all_varyings_in_vbos() but we are
* only interested in per-vertex data. See bug 38626.
@@ -342,240 +83,6 @@ all_varyings_in_vbos(const struct gl_client_array *arrays[])
}
-/**
- * Examine the active arrays to determine if we have interleaved
- * vertex arrays all living in one VBO, or all living in user space.
- */
-static GLboolean
-is_interleaved_arrays(const struct st_vertex_program *vp,
- const struct st_vp_variant *vpv,
- const struct gl_client_array **arrays)
-{
- GLuint attr;
- const struct gl_buffer_object *firstBufObj = NULL;
- GLint firstStride = -1;
- const GLubyte *firstPtr = NULL;
- GLboolean userSpaceBuffer = GL_FALSE;
-
- for (attr = 0; attr < vpv->num_inputs; attr++) {
- const GLuint mesaAttr = vp->index_to_input[attr];
- const struct gl_client_array *array = arrays[mesaAttr];
- const struct gl_buffer_object *bufObj = array->BufferObj;
- const GLsizei stride = array->StrideB; /* in bytes */
-
- if (attr == 0) {
- /* save info about the first array */
- firstStride = stride;
- firstPtr = array->Ptr;
- firstBufObj = bufObj;
- userSpaceBuffer = !bufObj || !bufObj->Name;
- }
- else {
- /* check if other arrays interleave with the first, in same buffer */
- if (stride != firstStride)
- return GL_FALSE; /* strides don't match */
-
- if (bufObj != firstBufObj)
- return GL_FALSE; /* arrays in different VBOs */
-
- if (abs(array->Ptr - firstPtr) > firstStride)
- return GL_FALSE; /* arrays start too far apart */
-
- if ((!_mesa_is_bufferobj(bufObj)) != userSpaceBuffer)
- return GL_FALSE; /* mix of VBO and user-space arrays */
- }
- }
-
- return GL_TRUE;
-}
-
-
-/**
- * Set up for drawing interleaved arrays that all live in one VBO
- * or all live in user space.
- * \param vbuffer returns vertex buffer info
- * \param velements returns vertex element info
- * \return GL_TRUE for success, GL_FALSE otherwise (probably out of memory)
- */
-static GLboolean
-setup_interleaved_attribs(struct gl_context *ctx,
- const struct st_vertex_program *vp,
- const struct st_vp_variant *vpv,
- const struct gl_client_array **arrays,
- struct pipe_vertex_buffer *vbuffer,
- struct pipe_vertex_element velements[])
-{
- GLuint attr;
- const GLubyte *low_addr = NULL;
- GLboolean usingVBO; /* all arrays in a VBO? */
- struct gl_buffer_object *bufobj;
- GLsizei stride;
-
- /* Find the lowest address of the arrays we're drawing,
- * Init bufobj and stride.
- */
- if (vpv->num_inputs) {
- const GLuint mesaAttr0 = vp->index_to_input[0];
- const struct gl_client_array *array = arrays[mesaAttr0];
-
- /* Since we're doing interleaved arrays, we know there'll be at most
- * one buffer object and the stride will be the same for all arrays.
- * Grab them now.
- */
- bufobj = array->BufferObj;
- stride = array->StrideB;
-
- low_addr = arrays[vp->index_to_input[0]]->Ptr;
-
- for (attr = 1; attr < vpv->num_inputs; attr++) {
- const GLubyte *start = arrays[vp->index_to_input[attr]]->Ptr;
- low_addr = MIN2(low_addr, start);
- }
- }
- else {
- /* not sure we'll ever have zero inputs, but play it safe */
- bufobj = NULL;
- stride = 0;
- low_addr = 0;
- }
-
- /* are the arrays in user space? */
- usingVBO = _mesa_is_bufferobj(bufobj);
-
- for (attr = 0; attr < vpv->num_inputs; attr++) {
- const GLuint mesaAttr = vp->index_to_input[attr];
- const struct gl_client_array *array = arrays[mesaAttr];
- unsigned src_offset = (unsigned) (array->Ptr - low_addr);
- GLuint element_size = array->_ElementSize;
-
- assert(element_size == array->Size * _mesa_sizeof_type(array->Type));
-
- velements[attr].src_offset = src_offset;
- velements[attr].instance_divisor = array->InstanceDivisor;
- velements[attr].vertex_buffer_index = 0;
- velements[attr].src_format = st_pipe_vertex_format(array->Type,
- array->Size,
- array->Format,
- array->Normalized,
- array->Integer);
- assert(velements[attr].src_format);
- }
-
- /*
- * Return the vbuffer info and setup user-space attrib info, if needed.
- */
- if (vpv->num_inputs == 0) {
- /* just defensive coding here */
- vbuffer->buffer = NULL;
- vbuffer->user_buffer = NULL;
- vbuffer->buffer_offset = 0;
- vbuffer->stride = 0;
- }
- else if (usingVBO) {
- /* all interleaved arrays in a VBO */
- struct st_buffer_object *stobj = st_buffer_object(bufobj);
-
- if (!stobj || !stobj->buffer) {
- /* probably out of memory (or zero-sized buffer) */
- return GL_FALSE;
- }
-
- vbuffer->buffer = stobj->buffer;
- vbuffer->user_buffer = NULL;
- vbuffer->buffer_offset = pointer_to_offset(low_addr);
- vbuffer->stride = stride;
- }
- else {
- /* all interleaved arrays in user memory */
- vbuffer->buffer = NULL;
- vbuffer->user_buffer = low_addr;
- vbuffer->buffer_offset = 0;
- vbuffer->stride = stride;
- }
-
- return GL_TRUE;
-}
-
-
-/**
- * Set up a separate pipe_vertex_buffer and pipe_vertex_element for each
- * vertex attribute.
- * \param vbuffer returns vertex buffer info
- * \param velements returns vertex element info
- * \return GL_TRUE for success, GL_FALSE otherwise (probably out of memory)
- */
-static GLboolean
-setup_non_interleaved_attribs(struct gl_context *ctx,
- const struct st_vertex_program *vp,
- const struct st_vp_variant *vpv,
- const struct gl_client_array **arrays,
- struct pipe_vertex_buffer vbuffer[],
- struct pipe_vertex_element velements[])
-{
- GLuint attr;
-
- for (attr = 0; attr < vpv->num_inputs; attr++) {
- const GLuint mesaAttr = vp->index_to_input[attr];
- const struct gl_client_array *array = arrays[mesaAttr];
- struct gl_buffer_object *bufobj = array->BufferObj;
- GLsizei stride = array->StrideB;
-
- assert(array->_ElementSize == array->Size * _mesa_sizeof_type(array->Type));
-
- if (_mesa_is_bufferobj(bufobj)) {
- /* Attribute data is in a VBO.
- * Recall that for VBOs, the gl_client_array->Ptr field is
- * really an offset from the start of the VBO, not a pointer.
- */
- struct st_buffer_object *stobj = st_buffer_object(bufobj);
-
- if (!stobj || !stobj->buffer) {
- /* probably out of memory (or zero-sized buffer) */
- return GL_FALSE;
- }
-
- vbuffer[attr].buffer = stobj->buffer;
- vbuffer[attr].user_buffer = NULL;
- vbuffer[attr].buffer_offset = pointer_to_offset(array->Ptr);
- }
- else {
- /* wrap user data */
- void *ptr;
-
- if (array->Ptr) {
- ptr = (void *) array->Ptr;
- }
- else {
- /* no array, use ctx->Current.Attrib[] value */
- ptr = (void *) ctx->Current.Attrib[mesaAttr];
- stride = 0;
- }
-
- assert(ptr);
-
- vbuffer[attr].buffer = NULL;
- vbuffer[attr].user_buffer = ptr;
- vbuffer[attr].buffer_offset = 0;
- }
-
- /* common-case setup */
- vbuffer[attr].stride = stride; /* in bytes */
-
- velements[attr].src_offset = 0;
- velements[attr].instance_divisor = array->InstanceDivisor;
- velements[attr].vertex_buffer_index = attr;
- velements[attr].src_format = st_pipe_vertex_format(array->Type,
- array->Size,
- array->Format,
- array->Normalized,
- array->Integer);
- assert(velements[attr].src_format);
- }
-
- return GL_TRUE;
-}
-
-
static void
setup_index_buffer(struct st_context *st,
const struct _mesa_index_buffer *ib,
@@ -664,58 +171,6 @@ translate_prim(const struct gl_context *ctx, unsigned prim)
}
-/**
- * Setup vertex arrays and buffers prior to drawing.
- * \return GL_TRUE for success, GL_FALSE otherwise (probably out of memory)
- */
-static GLboolean
-st_validate_varrays(struct gl_context *ctx,
- const struct gl_client_array **arrays)
-{
- struct st_context *st = st_context(ctx);
- const struct st_vertex_program *vp;
- const struct st_vp_variant *vpv;
- struct pipe_vertex_buffer vbuffer[PIPE_MAX_SHADER_INPUTS];
- struct pipe_vertex_element velements[PIPE_MAX_ATTRIBS];
- unsigned num_vbuffers, num_velements;
-
- /* must get these after state validation! */
- vp = st->vp;
- vpv = st->vp_variant;
-
- memset(velements, 0, sizeof(struct pipe_vertex_element) * vpv->num_inputs);
-
- /*
- * Setup the vbuffer[] and velements[] arrays.
- */
- if (is_interleaved_arrays(vp, vpv, arrays)) {
- if (!setup_interleaved_attribs(ctx, vp, vpv, arrays, vbuffer,
- velements)) {
- return GL_FALSE;
- }
-
- num_vbuffers = 1;
- num_velements = vpv->num_inputs;
- if (num_velements == 0)
- num_vbuffers = 0;
- }
- else {
- if (!setup_non_interleaved_attribs(ctx, vp, vpv, arrays,
- vbuffer, velements)) {
- return GL_FALSE;
- }
-
- num_vbuffers = vpv->num_inputs;
- num_velements = vpv->num_inputs;
- }
-
- cso_set_vertex_buffers(st->cso_context, num_vbuffers, vbuffer);
- cso_set_vertex_elements(st->cso_context, num_velements, velements);
-
- return GL_TRUE;
-}
-
-
/**
* This function gets plugged into the VBO module and is called when
* we have something to render.
@@ -736,38 +191,16 @@ st_draw_vbo(struct gl_context *ctx,
struct pipe_draw_info info;
const struct gl_client_array **arrays = ctx->Array._DrawArrays;
unsigned i;
- GLboolean new_array;
/* Mesa core state should have been validated already */
assert(ctx->NewState == 0x0);
- /* Get Mesa driver state. */
- st->dirty.st |= ctx->NewDriverState;
- ctx->NewDriverState = 0;
-
- new_array =
- (st->dirty.st & (ST_NEW_VERTEX_ARRAYS | ST_NEW_VERTEX_PROGRAM)) ||
- (st->dirty.mesa & (_NEW_PROGRAM | _NEW_BUFFER_OBJECT)) != 0;
-
/* Validate state. */
- if (st->dirty.st) {
- GLboolean vertDataEdgeFlags;
-
- vertDataEdgeFlags = arrays[VERT_ATTRIB_EDGEFLAG]->BufferObj &&
- arrays[VERT_ATTRIB_EDGEFLAG]->BufferObj->Name;
- if (vertDataEdgeFlags != st->vertdata_edgeflags) {
- st->vertdata_edgeflags = vertDataEdgeFlags;
- st->dirty.st |= ST_NEW_EDGEFLAGS_DATA;
- }
-
+ if (st->dirty.st || ctx->NewDriverState) {
st_validate_state(st);
- if (new_array) {
- if (!st_validate_varrays(ctx, arrays)) {
- /* probably out of memory, no-op the draw call */
- return;
- }
- }
+ if (st->vertex_array_out_of_memory)
+ return;
#if 0
if (MESA_VERBOSE & VERBOSE_GLSL) {
diff --git a/mesalib/src/mesa/state_tracker/st_draw.h b/mesalib/src/mesa/state_tracker/st_draw.h
index c608051eb..3313fc8c7 100644
--- a/mesalib/src/mesa/state_tracker/st_draw.h
+++ b/mesalib/src/mesa/state_tracker/st_draw.h
@@ -67,13 +67,6 @@ st_feedback_draw_vbo(struct gl_context *ctx,
GLuint max_index,
struct gl_transform_feedback_object *tfb_vertcount);
-/* Internal function:
- */
-extern enum pipe_format
-st_pipe_vertex_format(GLenum type, GLuint size, GLenum format,
- GLboolean normalized, GLboolean integer);
-
-
/**
* When drawing with VBOs, the addresses specified with
* glVertex/Color/TexCoordPointer() are really offsets into the VBO, not real
diff --git a/pixman/test/stress-test.c b/pixman/test/stress-test.c
index 0b48da3f7..7fc067e82 100644
--- a/pixman/test/stress-test.c
+++ b/pixman/test/stress-test.c
@@ -412,6 +412,7 @@ set_general_properties (pixman_image_t *image, pixman_bool_t allow_alpha_map)
case 6: case 7:
n_rects = 3;
+ break;
default:
n_rects = lcg_rand_n (100);
diff --git a/xorg-server/Xi/exevents.c b/xorg-server/Xi/exevents.c
index 4aad52734..e99bf6c20 100644
--- a/xorg-server/Xi/exevents.c
+++ b/xorg-server/Xi/exevents.c
@@ -926,10 +926,10 @@ UpdateDeviceState(DeviceIntPtr device, DeviceEvent *event)
else if (event->type == ET_ProximityOut)
device->proximity->in_proximity = FALSE;
else if (event->type == ET_TouchBegin) {
- BUG_WARN(!b || !v);
- BUG_WARN(!t);
+ BUG_RETURN_VAL(!b || !v, DONT_PROCESS);
+ BUG_RETURN_VAL(!t, DONT_PROCESS);
- if (!b || !t || !b->map[key])
+ if (!b->map[key])
return DONT_PROCESS;
if (!(event->flags & TOUCH_POINTER_EMULATED) ||
@@ -941,10 +941,10 @@ UpdateDeviceState(DeviceIntPtr device, DeviceEvent *event)
UpdateDeviceMotionMask(device, t->state, DeviceButtonMotionMask);
}
else if (event->type == ET_TouchEnd) {
- BUG_WARN(!b || !v);
- BUG_WARN(!t);
+ BUG_RETURN_VAL(!b || !v, DONT_PROCESS);
+ BUG_RETURN_VAL(!t, DONT_PROCESS);
- if (!b || !t || t->buttonsDown <= 0 || !b->map[key])
+ if (t->buttonsDown <= 0 || !b->map[key])
return DONT_PROCESS;
if (!(event->flags & TOUCH_POINTER_EMULATED))
@@ -1356,9 +1356,8 @@ RetrieveTouchDeliveryData(DeviceIntPtr dev, TouchPointInfoPtr ti,
wOtherInputMasks(*win)->inputClients, next)
if (xi2mask_isset(iclients->xi2mask, dev, evtype))
break;
- BUG_WARN(!iclients);
- if (!iclients)
- return FALSE;
+
+ BUG_RETURN_VAL(!iclients, FALSE);
*mask = iclients->xi2mask;
*client = rClient(iclients);
@@ -1371,9 +1370,7 @@ RetrieveTouchDeliveryData(DeviceIntPtr dev, TouchPointInfoPtr ti,
wOtherInputMasks(*win)->inputClients, next)
if (iclients->mask[dev->id] & xi_filter)
break;
- BUG_WARN(!iclients);
- if (!iclients)
- return FALSE;
+ BUG_RETURN_VAL(!iclients, FALSE);
*client = rClient(iclients);
}
@@ -1414,9 +1411,7 @@ DeliverTouchEmulatedEvent(DeviceIntPtr dev, TouchPointInfoPtr ti,
return Success;
nevents = TouchConvertToPointerEvent(ev, &motion, &button);
- BUG_WARN(nevents == 0);
- if (nevents == 0)
- return BadValue;
+ BUG_RETURN_VAL(nevents == 0, BadValue);
if (nevents > 1)
ptrev = &button;
diff --git a/xorg-server/Xi/xichangehierarchy.c b/xorg-server/Xi/xichangehierarchy.c
index 756aaac06..89f16d8be 100644
--- a/xorg-server/Xi/xichangehierarchy.c
+++ b/xorg-server/Xi/xichangehierarchy.c
@@ -293,12 +293,6 @@ remove_master(ClientPtr client, xXIRemoveMasterInfo * r, int flags[MAXDEVICES])
}
}
- /* can't disable until we removed pairing */
- keybd->spriteInfo->paired = NULL;
- ptr->spriteInfo->paired = NULL;
- XTestptr->spriteInfo->paired = NULL;
- XTestkeybd->spriteInfo->paired = NULL;
-
/* disable the remove the devices, XTest devices must be done first
else the sprites they rely on will be destroyed */
DisableDevice(XTestptr, FALSE);
diff --git a/xorg-server/configure.ac b/xorg-server/configure.ac
index 9ae77fbae..fb3d12092 100644
--- a/xorg-server/configure.ac
+++ b/xorg-server/configure.ac
@@ -777,7 +777,7 @@ DRI2PROTO="dri2proto >= 2.7"
XINERAMAPROTO="xineramaproto"
BIGFONTPROTO="xf86bigfontproto >= 1.2.0"
DGAPROTO="xf86dgaproto >= 2.0.99.1"
-GLPROTO="glproto >= 1.4.14"
+GLPROTO="glproto >= 1.4.15"
DMXPROTO="dmxproto >= 2.2.99.1"
VIDMODEPROTO="xf86vidmodeproto >= 2.2.99.1"
WINDOWSWMPROTO="windowswmproto"
diff --git a/xorg-server/dix/devices.c b/xorg-server/dix/devices.c
index 0c62a012d..08875bc3a 100644
--- a/xorg-server/dix/devices.c
+++ b/xorg-server/dix/devices.c
@@ -178,12 +178,9 @@ DeviceSetProperty(DeviceIntPtr dev, Atom property, XIPropertyValuePtr prop,
/* Pair the keyboard to the pointer device. Keyboard events will follow the
* pointer sprite. Only applicable for master devices.
- * If the client is set, the request to pair comes from some client. In this
- * case, we need to check for access. If the client is NULL, it's from an
- * internal automatic pairing, we must always permit this.
*/
static int
-PairDevices(ClientPtr client, DeviceIntPtr ptr, DeviceIntPtr kbd)
+PairDevices(DeviceIntPtr ptr, DeviceIntPtr kbd)
{
if (!ptr)
return BadDevice;
@@ -365,13 +362,12 @@ EnableDevice(DeviceIntPtr dev, BOOL sendevent)
/* mode doesn't matter */
EnterWindow(dev, screenInfo.screens[0]->root, NotifyAncestor);
}
- else if ((other = NextFreePointerDevice()) == NULL) {
- ErrorF("[dix] cannot find pointer to pair with. "
- "This is a bug.\n");
- return FALSE;
+ else {
+ other = NextFreePointerDevice();
+ BUG_RETURN_VAL_MSG(other == NULL, FALSE,
+ "[dix] cannot find pointer to pair with.\n");
+ PairDevices(other, dev);
}
- else
- PairDevices(NULL, other, dev);
}
else {
if (dev->coreEvents)
@@ -432,6 +428,9 @@ DisableDevice(DeviceIntPtr dev, BOOL sendevent)
BOOL enabled;
int flags[MAXDEVICES] = { 0 };
+ if (!dev->enabled)
+ return TRUE;
+
for (prev = &inputInfo.devices;
*prev && (*prev != dev); prev = &(*prev)->next);
if (*prev != dev)
@@ -458,18 +457,19 @@ DisableDevice(DeviceIntPtr dev, BOOL sendevent)
}
if (IsMaster(dev) && dev->spriteInfo->sprite) {
- for (other = inputInfo.devices; other; other = other->next) {
- if (other->spriteInfo->paired == dev) {
- ErrorF("[dix] cannot disable device, still paired. "
- "This is a bug. \n");
- return FALSE;
- }
- }
+ for (other = inputInfo.devices; other; other = other->next)
+ if (other->spriteInfo->paired == dev && !other->spriteInfo->spriteOwner)
+ DisableDevice(other, sendevent);
}
+ if (dev->spriteInfo->paired)
+ dev->spriteInfo->paired = NULL;
+
(void) (*dev->deviceProc) (dev, DEVICE_OFF);
dev->enabled = FALSE;
+ FreeSprite(dev);
+
/* now that the device is disabled, we can reset the signal handler's
* last.slave */
OsBlockSignals();
@@ -501,6 +501,26 @@ DisableDevice(DeviceIntPtr dev, BOOL sendevent)
return TRUE;
}
+void
+DisableAllDevices(void)
+{
+ DeviceIntPtr dev, tmp;
+
+ nt_list_for_each_entry_safe(dev, tmp, inputInfo.devices, next) {
+ if (!IsMaster(dev))
+ DisableDevice(dev, FALSE);
+ }
+ /* master keyboards need to be disabled first */
+ nt_list_for_each_entry_safe(dev, tmp, inputInfo.devices, next) {
+ if (dev->enabled && IsMaster(dev) && IsKeyboardDevice(dev))
+ DisableDevice(dev, FALSE);
+ }
+ nt_list_for_each_entry_safe(dev, tmp, inputInfo.devices, next) {
+ if (dev->enabled)
+ DisableDevice(dev, FALSE);
+ }
+}
+
/**
* Initialise a new device through the driver and tell all clients about the
* new device.
@@ -923,12 +943,7 @@ CloseDevice(DeviceIntPtr dev)
free(classes);
}
- if (DevHasCursor(dev) && dev->spriteInfo->sprite) {
- if (dev->spriteInfo->sprite->current)
- FreeCursor(dev->spriteInfo->sprite->current, None);
- free(dev->spriteInfo->sprite->spriteTrace);
- free(dev->spriteInfo->sprite);
- }
+ FreeSprite(dev);
/* a client may have the device set as client pointer */
for (j = 0; j < currentMaxClients; j++) {
diff --git a/xorg-server/dix/events.c b/xorg-server/dix/events.c
index 83ae5c965..49894fa26 100644
--- a/xorg-server/dix/events.c
+++ b/xorg-server/dix/events.c
@@ -3192,6 +3192,18 @@ InitializeSprite(DeviceIntPtr pDev, WindowPtr pWin)
#endif
}
+void FreeSprite(DeviceIntPtr dev)
+{
+ if (DevHasCursor(dev) && dev->spriteInfo->sprite) {
+ if (dev->spriteInfo->sprite->current)
+ FreeCursor(dev->spriteInfo->sprite->current, None);
+ free(dev->spriteInfo->sprite->spriteTrace);
+ free(dev->spriteInfo->sprite);
+ }
+ dev->spriteInfo->sprite = NULL;
+}
+
+
/**
* Update the mouse sprite info when the server switches from a pScreen to another.
* Otherwise, the pScreen of the mouse sprite is never updated when we switch
diff --git a/xorg-server/dix/getevents.c b/xorg-server/dix/getevents.c
index 4fbaa6c94..baa26c4b8 100644
--- a/xorg-server/dix/getevents.c
+++ b/xorg-server/dix/getevents.c
@@ -1821,10 +1821,7 @@ GetTouchEvents(InternalEvent *events, DeviceIntPtr dev, uint32_t ddx_touchid,
if (flags & TOUCH_CLIENT_ID) { /* A DIX-submitted TouchEnd */
touchpoint.dix_ti = TouchFindByClientID(dev, ddx_touchid);
- BUG_WARN(!touchpoint.dix_ti);
-
- if (!touchpoint.dix_ti)
- return 0;
+ BUG_RETURN_VAL(!touchpoint.dix_ti, 0);
if (!mask_in ||
!valuator_mask_isset(mask_in, 0) ||
diff --git a/xorg-server/dix/main.c b/xorg-server/dix/main.c
index 83efa7d7f..e95ca1cc2 100644
--- a/xorg-server/dix/main.c
+++ b/xorg-server/dix/main.c
@@ -104,6 +104,7 @@ Equipment Corporation.
#include "privates.h"
#include "registry.h"
#include "client.h"
+#include "exevents.h"
#ifdef PANORAMIX
#include "panoramiXsrv.h"
#else
@@ -295,6 +296,7 @@ main(int argc, char *argv[], char *envp[])
#endif
UndisplayDevices();
+ DisableAllDevices();
/* Now free up whatever must be freed */
if (screenIsSaved == SCREEN_SAVER_ON)
@@ -318,7 +320,9 @@ main(int argc, char *argv[], char *envp[])
for (i = 0; i < screenInfo.numScreens; i++)
screenInfo.screens[i]->root = NullWindow;
+
CloseDownDevices();
+
CloseDownEvents();
for (i = screenInfo.numScreens - 1; i >= 0; i--) {
diff --git a/xorg-server/dix/touch.c b/xorg-server/dix/touch.c
index 401cb981a..aa17faf28 100644
--- a/xorg-server/dix/touch.c
+++ b/xorg-server/dix/touch.c
@@ -103,11 +103,11 @@ TouchResizeQueue(ClientPtr client, pointer closure)
tmp = realloc(dev->last.touches, size * sizeof(*dev->last.touches));
if (tmp) {
- int i;
+ int j;
dev->last.touches = tmp;
- for (i = dev->last.num_touches; i < size; i++)
- TouchInitDDXTouchPoint(dev, &dev->last.touches[i]);
+ for (j = dev->last.num_touches; j < size; j++)
+ TouchInitDDXTouchPoint(dev, &dev->last.touches[j]);
dev->last.num_touches = size;
}
@@ -598,8 +598,8 @@ TouchConvertToPointerEvent(const InternalEvent *event,
int ptrtype;
int nevents = 0;
- BUG_WARN(!event);
- BUG_WARN(!motion_event);
+ BUG_RETURN_VAL(!event, 0);
+ BUG_RETURN_VAL(!motion_event, 0);
switch (event->any.type) {
case ET_TouchUpdate:
@@ -627,7 +627,7 @@ TouchConvertToPointerEvent(const InternalEvent *event,
motion_event->device_event.flags = XIPointerEmulated;
if (nevents > 1) {
- BUG_WARN(!button_event);
+ BUG_RETURN_VAL(!button_event, 0);
*button_event = *event;
button_event->any.type = ptrtype;
button_event->device_event.flags = XIPointerEmulated;
@@ -966,10 +966,8 @@ TouchListenerAcceptReject(DeviceIntPtr dev, TouchPointInfoPtr ti, int listener,
int nev;
int i;
- BUG_WARN(listener < 0);
- BUG_WARN(listener >= ti->num_listeners);
- if (listener < 0 || listener >= ti->num_listeners)
- return BadMatch;
+ BUG_RETURN_VAL(listener < 0, BadMatch);
+ BUG_RETURN_VAL(listener >= ti->num_listeners, BadMatch);
if (listener > 0) {
if (mode == XIRejectTouch)
@@ -981,10 +979,7 @@ TouchListenerAcceptReject(DeviceIntPtr dev, TouchPointInfoPtr ti, int listener,
}
events = InitEventList(GetMaximumEventsNum());
- if (!events) {
- BUG_WARN_MSG(TRUE, "Failed to allocate touch ownership events\n");
- return BadAlloc;
- }
+ BUG_RETURN_VAL_MSG(!events, BadAlloc, "Failed to allocate touch ownership events\n");
nev = GetTouchOwnershipEvents(events, dev, ti, mode,
ti->listeners[0].listener, 0);
diff --git a/xorg-server/glx/clientinfo.c b/xorg-server/glx/clientinfo.c
index 15bbf15af..b26ac1a72 100644
--- a/xorg-server/glx/clientinfo.c
+++ b/xorg-server/glx/clientinfo.c
@@ -26,17 +26,62 @@
#include "glxserver.h"
#include "indirect_dispatch.h"
+#include "glxbyteorder.h"
+#include "unpack.h"
int
__glXDisp_SetClientInfoARB(__GLXclientState * cl, GLbyte * pc)
{
- return BadRequest;
+ xGLXSetClientInfoARBReq *req = (xGLXSetClientInfoARBReq *) pc;
+ char *gl_extensions;
+ char *glx_extensions;
+
+ /* Verify that the size of the packet matches the size inferred from the
+ * sizes specified for the various fields.
+ */
+ const unsigned expected_size = sz_xGLXSetClientInfoARBReq
+ + (req->numVersions * 8)
+ + __GLX_PAD(req->numGLExtensionBytes)
+ + __GLX_PAD(req->numGLXExtensionBytes);
+
+ if (req->length != (expected_size / 4))
+ return BadLength;
+
+ /* Verify that the actual length of the GL extension string matches what's
+ * encoded in protocol packet.
+ */
+ gl_extensions = (char *) (req + 1) + (req->numVersions * 8);
+ if (req->numGLExtensionBytes != 0
+ && memchr(gl_extensions, 0,
+ __GLX_PAD(req->numGLExtensionBytes)) == NULL)
+ return BadLength;
+
+ /* Verify that the actual length of the GLX extension string matches
+ * what's encoded in protocol packet.
+ */
+ glx_extensions = gl_extensions + __GLX_PAD(req->numGLExtensionBytes);
+ if (req->numGLXExtensionBytes != 0
+ && memchr(glx_extensions, 0,
+ __GLX_PAD(req->numGLXExtensionBytes)) == NULL)
+ return BadLength;
+
+ free(cl->GLClientextensions);
+ cl->GLClientextensions = strdup(gl_extensions);
+
+ return 0;
}
int
__glXDispSwap_SetClientInfoARB(__GLXclientState * cl, GLbyte * pc)
{
- return BadRequest;
+ xGLXSetClientInfoARBReq *req = (xGLXSetClientInfoARBReq *) pc;
+
+ req->length = bswap_16(req->length);
+ req->numVersions = bswap_32(req->numVersions);
+ req->numGLExtensionBytes = bswap_32(req->numGLExtensionBytes);
+ req->numGLXExtensionBytes = bswap_32(req->numGLXExtensionBytes);
+
+ return __glXDisp_SetClientInfoARB(cl, pc);
}
int
diff --git a/xorg-server/glx/createcontext.c b/xorg-server/glx/createcontext.c
index 9c1eab3e4..025c423fe 100644
--- a/xorg-server/glx/createcontext.c
+++ b/xorg-server/glx/createcontext.c
@@ -24,13 +24,224 @@
#include
#endif
+#include
#include "glxserver.h"
+#include "glxext.h"
#include "indirect_dispatch.h"
+#define ALL_VALID_FLAGS \
+ (GLX_CONTEXT_DEBUG_BIT_ARB | GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB)
+
+static Bool
+validate_GL_version(int major_version, int minor_version)
+{
+ if (major_version <= 0 || minor_version < 0)
+ return False;
+
+ switch (major_version) {
+ case 1:
+ if (minor_version > 5)
+ return False;
+ break;
+
+ case 2:
+ if (minor_version > 1)
+ return False;
+ break;
+
+ case 3:
+ if (minor_version > 3)
+ return False;
+ break;
+
+ default:
+ break;
+ }
+
+ return True;
+}
+
+static Bool
+validate_render_type(uint32_t render_type)
+{
+ switch (render_type) {
+ case GLX_RGBA_TYPE:
+ case GLX_COLOR_INDEX_TYPE:
+ return True;
+ default:
+ return False;
+ }
+}
+
int
__glXDisp_CreateContextAttribsARB(__GLXclientState * cl, GLbyte * pc)
{
- return BadRequest;
+ ClientPtr client = cl->client;
+ xGLXCreateContextAttribsARBReq *req = (xGLXCreateContextAttribsARBReq *) pc;
+ int32_t *attribs = (req->numAttribs != 0) ? (int32_t *) (req + 1) : NULL;
+ unsigned i;
+ int major_version = 1;
+ int minor_version = 0;
+ uint32_t flags = 0;
+ uint32_t render_type = GLX_RGBA_TYPE;
+ __GLXcontext *ctx = NULL;
+ __GLXcontext *shareCtx = NULL;
+ __GLXscreen *glxScreen;
+ __GLXconfig *config;
+ int err;
+
+ /* Verify that the size of the packet matches the size inferred from the
+ * sizes specified for the various fields.
+ */
+ const unsigned expected_size = (sz_xGLXCreateContextAttribsARBReq
+ + (req->numAttribs * 8)) / 4;
+
+ if (req->length != expected_size)
+ return BadLength;
+
+ LEGAL_NEW_RESOURCE(req->context, client);
+
+ /* The GLX_ARB_create_context spec says:
+ *
+ * "* If is not a valid GLXFBConfig, GLXBadFBConfig is
+ * generated."
+ *
+ * On the client, the screen comes from the FBConfig, so GLXBadFBConfig
+ * should be issued if the screen is nonsense.
+ */
+ if (!validGlxScreen(client, req->screen, &glxScreen, &err))
+ return __glXError(GLXBadFBConfig);
+
+ if (!validGlxFBConfig(client, glxScreen, req->fbconfig, &config, &err))
+ return __glXError(GLXBadFBConfig);
+
+ /* Validate the context with which the new context should share resources.
+ */
+ if (req->shareList != None) {
+ if (!validGlxContext(client, req->shareList, DixReadAccess,
+ &shareCtx, &err))
+ return err;
+
+ /* The crazy condition is because C doesn't have a logical XOR
+ * operator. Comparing directly for equality may fail if one is 1 and
+ * the other is 2 even though both are logically true.
+ */
+ if (!!req->isDirect != !!shareCtx->isDirect) {
+ client->errorValue = req->shareList;
+ return BadMatch;
+ }
+
+ /* The GLX_ARB_create_context spec says:
+ *
+ * "* If the server context state for ...was
+ * created on a different screen than the one referenced by
+ * ...BadMatch is generated."
+ */
+ if (glxScreen != shareCtx->pGlxScreen) {
+ client->errorValue = shareCtx->pGlxScreen->pScreen->myNum;
+ return BadMatch;
+ }
+ }
+
+ for (i = 0; i < req->numAttribs; i++) {
+ switch (attribs[i * 2]) {
+ case GLX_CONTEXT_MAJOR_VERSION_ARB:
+ major_version = attribs[2 * i + 1];
+ break;
+
+ case GLX_CONTEXT_MINOR_VERSION_ARB:
+ minor_version = attribs[2 * i + 1];
+ break;
+
+ case GLX_CONTEXT_FLAGS_ARB:
+ flags = attribs[2 * i + 1];
+ break;
+
+ case GLX_RENDER_TYPE:
+ render_type = attribs[2 * i + 1];
+ break;
+
+ default:
+ return BadValue;
+ }
+ }
+
+ /* The GLX_ARB_create_context spec says:
+ *
+ * "If attributes GLX_CONTEXT_MAJOR_VERSION_ARB and
+ * GLX_CONTEXT_MINOR_VERSION_ARB, when considered together
+ * with attributes GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB and
+ * GLX_RENDER_TYPE, specify an OpenGL version and feature set
+ * that are not defined, BadMatch is generated.
+ *
+ * ...Feature deprecation was introduced with OpenGL 3.0, so
+ * forward-compatible contexts may only be requested for
+ * OpenGL 3.0 and above. Thus, examples of invalid
+ * combinations of attributes include:
+ *
+ * - Major version < 1 or > 3
+ * - Major version == 1 and minor version < 0 or > 5
+ * - Major version == 2 and minor version < 0 or > 1
+ * - Major version == 3 and minor version > 2
+ * - Forward-compatible flag set and major version < 3
+ * - Color index rendering and major version >= 3"
+ */
+ if (!validate_GL_version(major_version, minor_version))
+ return BadMatch;
+
+ if (major_version < 3
+ && ((flags & GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB) != 0))
+ return BadMatch;
+
+ if (major_version >= 3 && render_type == GLX_COLOR_INDEX_TYPE)
+ return BadMatch;
+
+ if (!validate_render_type(render_type))
+ return BadValue;
+
+ if ((flags & ~ALL_VALID_FLAGS) != 0)
+ return BadValue;
+
+ /* Allocate memory for the new context
+ */
+ if (req->isDirect) {
+ ctx = __glXdirectContextCreate(glxScreen, config, shareCtx);
+ err = BadAlloc;
+ }
+ else {
+ ctx = glxScreen->createContext(glxScreen, config, shareCtx,
+ req->numAttribs, (uint32_t *) attribs,
+ &err);
+ }
+
+ if (ctx == NULL)
+ return err;
+
+ ctx->pGlxScreen = glxScreen;
+ ctx->config = config;
+ ctx->id = req->context;
+ ctx->share_id = req->shareList;
+ ctx->idExists = True;
+ ctx->isCurrent = False;
+ ctx->isDirect = req->isDirect;
+ ctx->hasUnflushedCommands = False;
+ ctx->renderMode = GL_RENDER;
+ ctx->feedbackBuf = NULL;
+ ctx->feedbackBufSize = 0;
+ ctx->selectBuf = NULL;
+ ctx->selectBufSize = 0;
+ ctx->drawPriv = NULL;
+ ctx->readPriv = NULL;
+
+ /* Add the new context to the various global tables of GLX contexts.
+ */
+ if (!__glXAddContext(ctx)) {
+ (*ctx->destroy) (ctx);
+ client->errorValue = req->context;
+ return BadAlloc;
+ }
+
+ return Success;
}
int
diff --git a/xorg-server/glx/extension_string.c b/xorg-server/glx/extension_string.c
index 866f8bf45..6a1a6c6b2 100644
--- a/xorg-server/glx/extension_string.c
+++ b/xorg-server/glx/extension_string.c
@@ -67,23 +67,27 @@ struct extension_info {
static const struct extension_info known_glx_extensions[] = {
/* GLX_ARB_get_proc_address is implemented on the client. */
- {GLX(ARB_multisample), VER(1, 4), Y,},
-
- {GLX(EXT_import_context), VER(0, 0), Y,},
- {GLX(EXT_texture_from_pixmap), VER(0, 0), Y,},
- {GLX(EXT_visual_info), VER(0, 0), Y,},
- {GLX(EXT_visual_rating), VER(0, 0), Y,},
-
- {GLX(MESA_copy_sub_buffer), VER(0, 0), N,},
- {GLX(OML_swap_method), VER(0, 0), Y,},
- {GLX(SGI_make_current_read), VER(1, 3), N,},
- {GLX(SGI_swap_control), VER(0, 0), N,},
- {GLX(SGIS_multisample), VER(0, 0), Y,},
- {GLX(SGIX_fbconfig), VER(1, 3), Y,},
- {GLX(SGIX_pbuffer), VER(1, 3), Y,},
- {GLX(SGIX_visual_select_group), VER(0, 0), Y,},
- {GLX(INTEL_swap_event), VER(1, 4), N,},
- {NULL}
+ /* *INDENT-OFF* */
+ { GLX(ARB_create_context), VER(0,0), N, },
+ { GLX(ARB_create_context_profile), VER(0,0), N, },
+ { GLX(ARB_multisample), VER(1,4), Y, },
+
+ { GLX(EXT_import_context), VER(0,0), Y, },
+ { GLX(EXT_texture_from_pixmap), VER(0,0), Y, },
+ { GLX(EXT_visual_info), VER(0,0), Y, },
+ { GLX(EXT_visual_rating), VER(0,0), Y, },
+
+ { GLX(MESA_copy_sub_buffer), VER(0,0), N, },
+ { GLX(OML_swap_method), VER(0,0), Y, },
+ { GLX(SGI_make_current_read), VER(1,3), N, },
+ { GLX(SGI_swap_control), VER(0,0), N, },
+ { GLX(SGIS_multisample), VER(0,0), Y, },
+ { GLX(SGIX_fbconfig), VER(1,3), Y, },
+ { GLX(SGIX_pbuffer), VER(1,3), Y, },
+ { GLX(SGIX_visual_select_group), VER(0,0), Y, },
+ { GLX(INTEL_swap_event), VER(1,4), N, },
+ { NULL }
+ /* *INDENT-ON* */
};
/**
diff --git a/xorg-server/glx/extension_string.h b/xorg-server/glx/extension_string.h
index e02213f8f..947bf89e6 100644
--- a/xorg-server/glx/extension_string.h
+++ b/xorg-server/glx/extension_string.h
@@ -36,7 +36,9 @@
enum {
/* GLX_ARB_get_proc_address is implemented on the client. */
- ARB_multisample_bit = 0,
+ ARB_create_context_bit = 0,
+ ARB_create_context_profile_bit,
+ ARB_multisample_bit,
EXT_import_context_bit,
EXT_texture_from_pixmap_bit,
EXT_visual_info_bit,
diff --git a/xorg-server/glx/glxcmds.c b/xorg-server/glx/glxcmds.c
index 24fed8f63..d483bbf8a 100644
--- a/xorg-server/glx/glxcmds.c
+++ b/xorg-server/glx/glxcmds.c
@@ -50,7 +50,7 @@
#include "indirect_table.h"
#include "indirect_util.h"
-static int
+_X_HIDDEN int
validGlxScreen(ClientPtr client, int screen, __GLXscreen ** pGlxScreen,
int *err)
{
@@ -67,7 +67,7 @@ validGlxScreen(ClientPtr client, int screen, __GLXscreen ** pGlxScreen,
return TRUE;
}
-static int
+_X_HIDDEN int
validGlxFBConfig(ClientPtr client, __GLXscreen * pGlxScreen, XID id,
__GLXconfig ** config, int *err)
{
@@ -131,7 +131,7 @@ validGlxFBConfigForWindow(ClientPtr client, __GLXconfig * config,
return TRUE;
}
-static int
+_X_HIDDEN int
validGlxContext(ClientPtr client, XID id, int access_mode,
__GLXcontext ** context, int *err)
{
@@ -200,7 +200,7 @@ __glXdirectContextDestroy(__GLXcontext * context)
free(context);
}
-static __GLXcontext *
+_X_HIDDEN __GLXcontext *
__glXdirectContextCreate(__GLXscreen * screen,
__GLXconfig * modes, __GLXcontext * shareContext)
{
@@ -251,20 +251,20 @@ DoCreateContext(__GLXclientState * cl, GLXContextID gcId,
&shareglxc, &err))
return err;
- if (shareglxc->isDirect) {
- /*
- ** NOTE: no support for sharing display lists between direct
- ** contexts, even if they are in the same address space.
- */
-#if 0
- /* Disabling this code seems to allow shared display lists
- * and texture objects to work. We'll leave it disabled for now.
- */
+ /* Page 26 (page 32 of the PDF) of the GLX 1.4 spec says:
+ *
+ * "The server context state for all sharing contexts must exist
+ * in a single address space or a BadMatch error is generated."
+ *
+ * If the share context is indirect, force the new context to also be
+ * indirect. If the shard context is direct but the new context
+ * cannot be direct, generate BadMatch.
+ */
+ if (shareglxc->isDirect && !isDirect) {
client->errorValue = shareList;
return BadMatch;
-#endif
}
- else {
+ else if (!shareglxc->isDirect) {
/*
** Create an indirect context regardless of what the client asked
** for; this way we can share display list space with shareList.
@@ -276,42 +276,45 @@ DoCreateContext(__GLXclientState * cl, GLXContextID gcId,
/*
** Allocate memory for the new context
*/
- if (!isDirect)
- glxc = pGlxScreen->createContext(pGlxScreen, config, shareglxc);
+ if (!isDirect) {
+ /* Without any attributes, the only error that the driver should be
+ * able to generate is BadAlloc. As result, just drop the error
+ * returned from the driver on the floor.
+ */
+ glxc = pGlxScreen->createContext(pGlxScreen, config, shareglxc,
+ 0, NULL, &err);
+ }
else
glxc = __glXdirectContextCreate(pGlxScreen, config, shareglxc);
if (!glxc) {
return BadAlloc;
}
- /*
- ** Initially, setup the part of the context that could be used by
- ** a GL core that needs windowing information (e.g., Mesa).
+ /* Initialize the GLXcontext structure.
*/
glxc->pGlxScreen = pGlxScreen;
glxc->config = config;
-
- /*
- ** Register this context as a resource.
- */
- if (!AddResource(gcId, __glXContextRes, (pointer) glxc)) {
- (*glxc->destroy) (glxc);
- client->errorValue = gcId;
- return BadAlloc;
- }
-
- /*
- ** Finally, now that everything is working, setup the rest of the
- ** context.
- */
glxc->id = gcId;
glxc->share_id = shareList;
glxc->idExists = GL_TRUE;
glxc->isCurrent = GL_FALSE;
glxc->isDirect = isDirect;
+ glxc->hasUnflushedCommands = GL_FALSE;
glxc->renderMode = GL_RENDER;
-
- __glXAddToContextList(glxc);
+ glxc->feedbackBuf = NULL;
+ glxc->feedbackBufSize = 0;
+ glxc->selectBuf = NULL;
+ glxc->selectBufSize = 0;
+ glxc->drawPriv = NULL;
+ glxc->readPriv = NULL;
+
+ /* Add the new context to the various global tables of GLX contexts.
+ */
+ if (!__glXAddContext(glxc)) {
+ (*glxc->destroy) (glxc);
+ client->errorValue = gcId;
+ return BadAlloc;
+ }
return Success;
}
@@ -2396,8 +2399,6 @@ __glXDisp_ClientInfo(__GLXclientState * cl, GLbyte * pc)
if (!memchr(buf, 0, (client->req_len << 2) - sizeof(xGLXClientInfoReq)))
return BadLength;
- cl->GLClientmajorVersion = req->major;
- cl->GLClientminorVersion = req->minor;
free(cl->GLClientextensions);
cl->GLClientextensions = strdup(buf);
diff --git a/xorg-server/glx/glxcontext.h b/xorg-server/glx/glxcontext.h
index ef2c4dbd5..b803a7fd1 100644
--- a/xorg-server/glx/glxcontext.h
+++ b/xorg-server/glx/glxcontext.h
@@ -121,4 +121,17 @@ struct __GLXcontext {
void __glXContextDestroy(__GLXcontext * context);
+extern int validGlxScreen(ClientPtr client, int screen,
+ __GLXscreen ** pGlxScreen, int *err);
+
+extern int validGlxFBConfig(ClientPtr client, __GLXscreen * pGlxScreen,
+ XID id, __GLXconfig ** config, int *err);
+
+extern int validGlxContext(ClientPtr client, XID id, int access_mode,
+ __GLXcontext ** context, int *err);
+
+extern __GLXcontext *__glXdirectContextCreate(__GLXscreen * screen,
+ __GLXconfig * modes,
+ __GLXcontext * shareContext);
+
#endif /* !__GLX_context_h__ */
diff --git a/xorg-server/glx/glxdri.c b/xorg-server/glx/glxdri.c
index f3690c859..a5d87ecac 100644
--- a/xorg-server/glx/glxdri.c
+++ b/xorg-server/glx/glxdri.c
@@ -599,7 +599,10 @@ __glXDRIscreenDestroy(__GLXscreen * baseScreen)
static __GLXcontext *
__glXDRIscreenCreateContext(__GLXscreen * baseScreen,
__GLXconfig * glxConfig,
- __GLXcontext * baseShareContext)
+ __GLXcontext * baseShareContext,
+ unsigned num_attribs,
+ const uint32_t *attribs,
+ int *error)
{
__GLXDRIscreen *screen = (__GLXDRIscreen *) baseScreen;
__GLXDRIcontext *context, *shareContext;
@@ -611,6 +614,13 @@ __glXDRIscreenCreateContext(__GLXscreen * baseScreen,
drm_context_t hwContext;
ScreenPtr pScreen = baseScreen->pScreen;
+ /* DRI1 cannot support createContextAttribs, so these parameters will
+ * never be used.
+ */
+ (void) num_attribs;
+ (void) attribs;
+ (void) error;
+
shareContext = (__GLXDRIcontext *) baseShareContext;
if (shareContext)
driShare = shareContext->driContext;
diff --git a/xorg-server/glx/glxdri2.c b/xorg-server/glx/glxdri2.c
index 6614666ca..7b76c3a5f 100644
--- a/xorg-server/glx/glxdri2.c
+++ b/xorg-server/glx/glxdri2.c
@@ -47,6 +47,7 @@
#include "glxserver.h"
#include "glxutil.h"
#include "glxdricommon.h"
+#include
#include "glapitable.h"
#include "glapi.h"
@@ -377,10 +378,150 @@ __glXDRIscreenDestroy(__GLXscreen * baseScreen)
free(screen);
}
+static Bool
+dri2_convert_glx_attribs(unsigned num_attribs, const uint32_t *attribs,
+ unsigned *major_ver, unsigned *minor_ver,
+ uint32_t *flags, unsigned *error)
+{
+ unsigned i;
+
+ if (num_attribs == 0)
+ return True;
+
+ if (attribs == NULL) {
+ *error = BadImplementation;
+ return False;
+ }
+
+ *major_ver = 1;
+ *minor_ver = 0;
+
+ for (i = 0; i < num_attribs; i++) {
+ switch (attribs[i * 2]) {
+ case GLX_CONTEXT_MAJOR_VERSION_ARB:
+ *major_ver = attribs[i * 2 + 1];
+ break;
+ case GLX_CONTEXT_MINOR_VERSION_ARB:
+ *minor_ver = attribs[i * 2 + 1];
+ break;
+ case GLX_CONTEXT_FLAGS_ARB:
+ *flags = attribs[i * 2 + 1];
+ break;
+ case GLX_RENDER_TYPE:
+ break;
+ default:
+ /* If an unknown attribute is received, fail.
+ */
+ *error = BadValue;
+ return False;
+ }
+ }
+
+ /* Unknown flag value.
+ */
+ if (*flags & ~(__DRI_CTX_FLAG_DEBUG | __DRI_CTX_FLAG_FORWARD_COMPATIBLE)) {
+ *error = BadValue;
+ return False;
+ }
+
+ *error = Success;
+ return True;
+}
+
+static void
+create_driver_context(__GLXDRIcontext * context,
+ __GLXDRIscreen * screen,
+ __GLXDRIconfig * config,
+ __DRIcontext * driShare,
+ unsigned num_attribs,
+ const uint32_t *attribs,
+ int *error)
+{
+ context->driContext = NULL;
+
+#if __DRI_DRI2_VERSION >= 3
+ if (screen->dri2->base.version >= 3) {
+ uint32_t ctx_attribs[3 * 2];
+ unsigned num_ctx_attribs = 0;
+ unsigned dri_err = 0;
+ unsigned major_ver;
+ unsigned minor_ver;
+ uint32_t flags;
+
+ if (num_attribs != 0) {
+ if (!dri2_convert_glx_attribs(num_attribs, attribs,
+ &major_ver, &minor_ver,
+ &flags, (unsigned *) error))
+ return NULL;
+
+ ctx_attribs[num_ctx_attribs++] = __DRI_CTX_ATTRIB_MAJOR_VERSION;
+ ctx_attribs[num_ctx_attribs++] = major_ver;
+ ctx_attribs[num_ctx_attribs++] = __DRI_CTX_ATTRIB_MINOR_VERSION;
+ ctx_attribs[num_ctx_attribs++] = minor_ver;
+
+ if (flags != 0) {
+ ctx_attribs[num_ctx_attribs++] = __DRI_CTX_ATTRIB_FLAGS;
+
+ /* The current __DRI_CTX_FLAG_* values are identical to the
+ * GLX_CONTEXT_*_BIT values.
+ */
+ ctx_attribs[num_ctx_attribs++] = flags;
+ }
+ }
+
+ context->driContext =
+ (*screen->dri2->createContextAttribs)(screen->driScreen,
+ __DRI_API_OPENGL,
+ config->driConfig,
+ driShare,
+ num_ctx_attribs / 2,
+ ctx_attribs,
+ &dri_err,
+ context);
+
+ switch (dri_err) {
+ case __DRI_CTX_ERROR_SUCCESS:
+ *error = Success;
+ break;
+ case __DRI_CTX_ERROR_NO_MEMORY:
+ *error = BadAlloc;
+ break;
+ case __DRI_CTX_ERROR_BAD_API:
+ *error = __glXError(GLXBadProfileARB);
+ break;
+ case __DRI_CTX_ERROR_BAD_VERSION:
+ case __DRI_CTX_ERROR_BAD_FLAG:
+ *error = __glXError(GLXBadFBConfig);
+ break;
+ case __DRI_CTX_ERROR_UNKNOWN_ATTRIBUTE:
+ case __DRI_CTX_ERROR_UNKNOWN_FLAG:
+ default:
+ *error = BadValue;
+ break;
+ }
+
+ return;
+ }
+#endif
+
+ if (num_attribs != 0) {
+ *error = BadValue;
+ return;
+ }
+
+ context->driContext =
+ (*screen->dri2->createNewContext) (screen->driScreen,
+ config->driConfig,
+ driShare, context);
+}
+
static __GLXcontext *
__glXDRIscreenCreateContext(__GLXscreen * baseScreen,
__GLXconfig * glxConfig,
- __GLXcontext * baseShareContext)
+ __GLXcontext * baseShareContext,
+ unsigned num_attribs,
+ const uint32_t *attribs,
+ int *error)
{
__GLXDRIscreen *screen = (__GLXDRIscreen *) baseScreen;
__GLXDRIcontext *context, *shareContext;
@@ -394,8 +535,10 @@ __glXDRIscreenCreateContext(__GLXscreen * baseScreen,
driShare = NULL;
context = calloc(1, sizeof *context);
- if (context == NULL)
+ if (context == NULL) {
+ *error = BadAlloc;
return NULL;
+ }
context->base.destroy = __glXDRIcontextDestroy;
context->base.makeCurrent = __glXDRIcontextMakeCurrent;
@@ -404,10 +547,8 @@ __glXDRIscreenCreateContext(__GLXscreen * baseScreen,
context->base.textureFromPixmap = &__glXDRItextureFromPixmap;
context->base.wait = __glXDRIcontextWait;
- context->driContext =
- (*screen->dri2->createNewContext) (screen->driScreen,
- config->driConfig,
- driShare, context);
+ create_driver_context(context, screen, config, driShare, num_attribs,
+ attribs, error);
if (context->driContext == NULL) {
free(context);
return NULL;
@@ -641,6 +782,14 @@ initializeExtensions(__GLXDRIscreen * screen)
__glXEnableExtension(screen->glx_enable_bits, "GLX_INTEL_swap_event");
LogMessage(X_INFO, "AIGLX: enabled GLX_INTEL_swap_event\n");
+#if __DRI_DRI2_VERSION >= 3
+ if (screen->dri2->base.version >= 3) {
+ __glXEnableExtension(screen->glx_enable_bits,
+ "GLX_ARB_create_context");
+ LogMessage(X_INFO, "AIGLX: enabled GLX_ARB_create_context\n");
+ }
+#endif
+
if (DRI2HasSwapControl(pScreen)) {
__glXEnableExtension(screen->glx_enable_bits, "GLX_SGI_swap_control");
__glXEnableExtension(screen->glx_enable_bits, "GLX_MESA_swap_control");
diff --git a/xorg-server/glx/glxdriswrast.c b/xorg-server/glx/glxdriswrast.c
index c69b4d258..b47839868 100644
--- a/xorg-server/glx/glxdriswrast.c
+++ b/xorg-server/glx/glxdriswrast.c
@@ -257,7 +257,10 @@ __glXDRIscreenDestroy(__GLXscreen * baseScreen)
static __GLXcontext *
__glXDRIscreenCreateContext(__GLXscreen * baseScreen,
__GLXconfig * glxConfig,
- __GLXcontext * baseShareContext)
+ __GLXcontext * baseShareContext,
+ unsigned num_attribs,
+ const uint32_t *attribs,
+ int *error)
{
__GLXDRIscreen *screen = (__GLXDRIscreen *) baseScreen;
__GLXDRIcontext *context, *shareContext;
@@ -265,6 +268,13 @@ __glXDRIscreenCreateContext(__GLXscreen * baseScreen,
const __DRIcoreExtension *core = screen->core;
__DRIcontext *driShare;
+ /* DRISWRAST won't support createContextAttribs, so these parameters will
+ * never be used.
+ */
+ (void) num_attribs;
+ (void) attribs;
+ (void) error;
+
shareContext = (__GLXDRIcontext *) baseShareContext;
if (shareContext)
driShare = shareContext->driContext;
diff --git a/xorg-server/glx/glxext.c b/xorg-server/glx/glxext.c
index acd696ef0..8d168d8a3 100644
--- a/xorg-server/glx/glxext.c
+++ b/xorg-server/glx/glxext.c
@@ -157,11 +157,18 @@ DrawableGone(__GLXdrawable * glxPriv, XID xid)
return True;
}
-void
-__glXAddToContextList(__GLXcontext * cx)
+Bool
+__glXAddContext(__GLXcontext * cx)
{
+ /* Register this context as a resource.
+ */
+ if (!AddResource(cx->id, __glXContextRes, (pointer)cx)) {
+ return False;
+ }
+
cx->next = glxAllContexts;
glxAllContexts = cx;
+ return True;
}
static void
@@ -281,8 +288,6 @@ glxClientCallback(CallbackListPtr *list, pointer closure, pointer data)
** By default, assume that the client supports
** GLX major version 1 minor version 0 protocol.
*/
- cl->GLClientmajorVersion = 1;
- cl->GLClientminorVersion = 0;
cl->client = pClient;
break;
diff --git a/xorg-server/glx/glxext.h b/xorg-server/glx/glxext.h
index 7cd5cb49f..9b0978b93 100644
--- a/xorg-server/glx/glxext.h
+++ b/xorg-server/glx/glxext.h
@@ -38,7 +38,7 @@
extern GLboolean __glXFreeContext(__GLXcontext * glxc);
extern void __glXFlushContextCache(void);
-extern void __glXAddToContextList(__GLXcontext * cx);
+extern Bool __glXAddContext(__GLXcontext * cx);
extern void __glXErrorCallBack(GLenum code);
extern void __glXClearErrorOccured(void);
extern GLboolean __glXErrorOccured(void);
diff --git a/xorg-server/glx/glxscreens.h b/xorg-server/glx/glxscreens.h
index 172268b29..b29df58a5 100644
--- a/xorg-server/glx/glxscreens.h
+++ b/xorg-server/glx/glxscreens.h
@@ -117,7 +117,10 @@ struct __GLXscreen {
__GLXcontext *(*createContext) (__GLXscreen * screen,
__GLXconfig * modes,
- __GLXcontext * shareContext);
+ __GLXcontext * shareContext,
+ unsigned num_attribs,
+ const uint32_t *attribs,
+ int *error);
__GLXdrawable *(*createDrawable) (ClientPtr client,
__GLXscreen * context,
diff --git a/xorg-server/glx/glxserver.h b/xorg-server/glx/glxserver.h
index 707684842..87c94d9ec 100644
--- a/xorg-server/glx/glxserver.h
+++ b/xorg-server/glx/glxserver.h
@@ -145,8 +145,6 @@ struct __GLXclientStateRec {
/* Back pointer to X client record */
ClientPtr client;
- int GLClientmajorVersion;
- int GLClientminorVersion;
char *GLClientextensions;
};
diff --git a/xorg-server/hw/dmx/dmx.c b/xorg-server/hw/dmx/dmx.c
index add0e5390..a226c5db1 100644
--- a/xorg-server/hw/dmx/dmx.c
+++ b/xorg-server/hw/dmx/dmx.c
@@ -74,8 +74,9 @@ _DMXXineramaActive(void)
{
#ifdef PANORAMIX
return !noPanoramiXExtension;
-#endif
+#else
return 0;
+#endif
}
static void
diff --git a/xorg-server/hw/xfree86/common/compiler.h b/xorg-server/hw/xfree86/common/compiler.h
index 0abdfb6c3..c980beeb9 100644
--- a/xorg-server/hw/xfree86/common/compiler.h
+++ b/xorg-server/hw/xfree86/common/compiler.h
@@ -119,6 +119,23 @@ extern _X_EXPORT unsigned int inb(unsigned long);
extern _X_EXPORT unsigned int inw(unsigned long);
extern _X_EXPORT unsigned int inl(unsigned long);
+#ifdef __SUNPRO_C
+extern _X_EXPORT unsigned char xf86ReadMmio8 (void *, unsigned long);
+extern _X_EXPORT unsigned short xf86ReadMmio16Be (void *, unsigned long);
+extern _X_EXPORT unsigned short xf86ReadMmio16Le (void *, unsigned long);
+extern _X_EXPORT unsigned int xf86ReadMmio32Be (void *, unsigned long);
+extern _X_EXPORT unsigned int xf86ReadMmio32Le (void *, unsigned long);
+extern _X_EXPORT void xf86WriteMmio8 (void *, unsigned long, unsigned int);
+extern _X_EXPORT void xf86WriteMmio16Be (void *, unsigned long, unsigned int);
+extern _X_EXPORT void xf86WriteMmio16Le (void *, unsigned long, unsigned int);
+extern _X_EXPORT void xf86WriteMmio32Be (void *, unsigned long, unsigned int);
+extern _X_EXPORT void xf86WriteMmio32Le (void *, unsigned long, unsigned int);
+extern _X_EXPORT void xf86WriteMmio8NB (void *, unsigned long, unsigned int);
+extern _X_EXPORT void xf86WriteMmio16BeNB (void *, unsigned long, unsigned int);
+extern _X_EXPORT void xf86WriteMmio16LeNB (void *, unsigned long, unsigned int);
+extern _X_EXPORT void xf86WriteMmio32BeNB (void *, unsigned long, unsigned int);
+extern _X_EXPORT void xf86WriteMmio32LeNB (void *, unsigned long, unsigned int);
+#endif /* _SUNPRO_C */
#endif /* __sparc__, __arm32__, __alpha__, __nds32__ */
#endif /* __arm__ */
diff --git a/xorg-server/hw/xfree86/fbdevhw/fbdevhwstub.c b/xorg-server/hw/xfree86/fbdevhw/fbdevhwstub.c
index b7b4d2e7d..7d554e60a 100644
--- a/xorg-server/hw/xfree86/fbdevhw/fbdevhwstub.c
+++ b/xorg-server/hw/xfree86/fbdevhw/fbdevhwstub.c
@@ -143,7 +143,7 @@ fbdevHWSwitchMode(ScrnInfoPtr pScrn, DisplayModePtr mode)
}
void
-fbdevHWAdjustFrame(ScrnInfoPtr pScrn, int x, int y, int flags)
+fbdevHWAdjustFrame(ScrnInfoPtr pScrn, int x, int y)
{
}
diff --git a/xorg-server/hw/xfree86/int10/generic.c b/xorg-server/hw/xfree86/int10/generic.c
index 5343e47e3..4633120fd 100644
--- a/xorg-server/hw/xfree86/int10/generic.c
+++ b/xorg-server/hw/xfree86/int10/generic.c
@@ -179,7 +179,7 @@ xf86ExtendedInitInt10(int entityIndex, int Flags)
vbiosMem = (char *) base + V_BIOS;
memset(vbiosMem, 0, 2 * V_BIOS_SIZE);
if (pci_device_read_rom(pInt->dev, vbiosMem) < V_BIOS_SIZE) {
- xf86DrvMsg(screen, X_WARNING,
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
"Unable to retrieve all of segment 0x0C0000.\n");
}
@@ -194,10 +194,10 @@ xf86ExtendedInitInt10(int entityIndex, int Flags)
vbiosMem = (unsigned char *) base + bios_location;
if (xf86IsEntityPrimary(entityIndex)) {
- if (int10_check_bios(screen, bios_location >> 4, vbiosMem))
+ if (int10_check_bios(pScrn->scrnIndex, bios_location >> 4, vbiosMem))
done = TRUE;
else
- xf86DrvMsg(screen, X_INFO,
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"No legacy BIOS found -- trying PCI\n");
}
if (!done) {
@@ -207,7 +207,7 @@ xf86ExtendedInitInt10(int entityIndex, int Flags)
err = pci_device_read_rom(rom_device, vbiosMem);
if (err) {
- xf86DrvMsg(screen, X_ERROR, "Cannot read V_BIOS (5) %s\n",
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Cannot read V_BIOS (5) %s\n",
strerror(err));
goto error1;
}
diff --git a/xorg-server/include/dix.h b/xorg-server/include/dix.h
index 5dc2ac568..3d8b0e575 100644
--- a/xorg-server/include/dix.h
+++ b/xorg-server/include/dix.h
@@ -395,6 +395,8 @@ DeliverTouchEvents(DeviceIntPtr /* dev */ ,
extern void
InitializeSprite(DeviceIntPtr /* pDev */ ,
WindowPtr /* pWin */ );
+extern void
+FreeSprite(DeviceIntPtr pDev);
extern void
UpdateSpriteForScreen(DeviceIntPtr /* pDev */ ,
diff --git a/xorg-server/include/input.h b/xorg-server/include/input.h
index bcf98a63e..5747f3cd2 100644
--- a/xorg-server/include/input.h
+++ b/xorg-server/include/input.h
@@ -264,7 +264,7 @@ extern _X_EXPORT Bool ActivateDevice(DeviceIntPtr /*device */ ,
extern _X_EXPORT Bool DisableDevice(DeviceIntPtr /*device */ ,
BOOL /* sendevent */ );
-
+extern void DisableAllDevices(void);
extern int InitAndStartDevices(void);
extern void CloseDownDevices(void);
diff --git a/xorg-server/include/misc.h b/xorg-server/include/misc.h
index 41c13332a..fea74b86c 100644
--- a/xorg-server/include/misc.h
+++ b/xorg-server/include/misc.h
@@ -381,4 +381,16 @@ extern _X_EXPORT unsigned long serverGeneration;
#define BUG_WARN(cond) __BUG_WARN_MSG(cond, 0, NULL)
+#define BUG_RETURN(cond) \
+ do { if (cond) { __BUG_WARN_MSG(cond, 0, NULL); return; } } while(0)
+
+#define BUG_RETURN_MSG(cond, ...) \
+ do { if (cond) { __BUG_WARN_MSG(cond, 1, __VA_ARGS__); return; } } while(0)
+
+#define BUG_RETURN_VAL(cond, val) \
+ do { if (cond) { __BUG_WARN_MSG(cond, 0, NULL); return (val); } } while(0)
+
+#define BUG_RETURN_VAL_MSG(cond, val, ...) \
+ do { if (cond) { __BUG_WARN_MSG(cond, 1, __VA_ARGS__); return (val); } } while(0)
+
#endif /* MISC_H */
diff --git a/xorg-server/test/touch.c b/xorg-server/test/touch.c
index 2ec535b43..df1db11de 100644
--- a/xorg-server/test/touch.c
+++ b/xorg-server/test/touch.c
@@ -40,6 +40,7 @@ touch_grow_queue(void)
int i;
memset(&dev, 0, sizeof(dev));
+ dev.name = "test device";
dev.id = 2;
dev.valuator = &val;
val.numAxes = 5;
@@ -94,6 +95,7 @@ touch_find_ddxid(void)
int i;
memset(&dev, 0, sizeof(dev));
+ dev.name = "test device";
dev.id = 2;
dev.valuator = &val;
val.numAxes = 5;
@@ -162,6 +164,7 @@ touch_begin_ddxtouch(void)
int size = 5;
memset(&dev, 0, sizeof(dev));
+ dev.name = "test device";
dev.id = 2;
dev.valuator = &val;
val.numAxes = 5;
@@ -209,6 +212,7 @@ touch_begin_touch(void)
screenInfo.screens[0] = &screen;
memset(&dev, 0, sizeof(dev));
+ dev.name = "test device";
dev.id = 2;
memset(&sprite, 0, sizeof(sprite));
@@ -247,6 +251,7 @@ touch_init(void)
screenInfo.screens[0] = &screen;
memset(&dev, 0, sizeof(dev));
+ dev.name = "test device";
memset(&sprite, 0, sizeof(sprite));
dev.spriteInfo = &sprite;
diff --git a/xorg-server/xkb/xkbAccessX.c b/xorg-server/xkb/xkbAccessX.c
index 95e28e789..fe28e12d7 100644
--- a/xorg-server/xkb/xkbAccessX.c
+++ b/xorg-server/xkb/xkbAccessX.c
@@ -295,10 +295,15 @@ AccessXKRGExpire(OsTimerPtr timer, CARD32 now, pointer arg)
cn.eventType = 0;
cn.requestMajor = 0;
cn.requestMinor = 0;
- if (xkbi->desc->ctrls->enabled_ctrls & XkbSlowKeysMask)
+ if (xkbi->desc->ctrls->enabled_ctrls & XkbSlowKeysMask) {
AccessXKRGTurnOff((DeviceIntPtr) arg, &cn);
- else
+ LogMessage(X_INFO, "XKB SlowKeys are disabled.\n");
+ }
+ else {
AccessXKRGTurnOn((DeviceIntPtr) arg, XkbSlowKeysMask, &cn);
+ LogMessage(X_INFO, "XKB SlowKeys are now enabled. Hold shift to disable.\n");
+ }
+
return 0;
}
--
cgit v1.2.3