Compare commits

..

38 Commits

Author SHA1 Message Date
Jonas Maebe
1bdf31e8da darwin: do not create double-buffered offscreen pixel formats
http://xquartz.macosforge.org/trac/ticket/536

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
(cherry picked from commit 5fdf1f784b)
2012-09-24 16:07:14 -07:00
Jeremy Huddleston
ecf0bef4cd darwin: Eliminate a possible race condition while destroying a surface
Introduced by: c60ffd2840
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
(cherry picked from commit d65bd195ec)
2012-05-16 18:59:30 -07:00
Jeremy Huddleston
60fa18b90f darwin: Unlock our mutex before destroying it
http://xquartz.macosforge.org/trac/ticket/575

Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
(cherry picked from commit a73a800b32)
2012-05-16 18:59:28 -07:00
Jeremy Huddleston
62058968e7 darwin: Eliminate a pthread mutex leak
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
Tested-by: Charles Davis <cdavis@mines.edu>
(cherry picked from commit 1a33c1b2b8)
2012-04-24 00:27:44 -07:00
Jonas Maebe
1fa6c87c88 apple: Fix a use after free
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
(cherry picked from commit c60ffd2840)
2012-04-23 16:18:36 -07:00
Jonas Maebe
00d310a130 glapi: Correct size of allocated _glapi_table struct
The __glapi_gentable_set_remaining_noop() routine treats the _glapi_struct
as an array of _glapi_get_dispatch_table_size() pointers, so we have to
allocate _glapi_get_dispatch_table_size()*sizeof(void*) bytes rather
than sizeof(struct _glapi_struct) bytes.

Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
(cherry picked from commit 8d09f4d0cc)
2012-04-22 20:41:36 -07:00
Jeremy Huddleston
906f670f1a configure.ac: Don't use $CLANG since it will collide with the static analyzer.
We just prefix the $CLANG environment variable in configure.ac with acv_mesa_

Found by: tinderbox
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
(cherry picked from commit b728eefb06)
2012-01-27 09:05:10 -08:00
Anuj Phogat
9ae2499be2 mesa: Add condition in glGetTexImage for zero size textures
TestMipMaps() function in src/OGLconform/textureNPOT.c calls glTexImage2D()
with width = 0. Texture with zero size skips miptree allocation due to a
condition in function _mesa_store_teximage3d(). While calling glGetTexImage()
it results in assertion failure in intel_map_texture_image() due to null mt
pointer.

This patch fixes the issue by detecting the zero size texture early in
glGetTexImage and glGetCompressedTexImage functions. In such a case function
simply returns doing nothing.
Verified that below mentioned bug is fixed by this patch.

https://bugs.freedesktop.org/show_bug.cgi?id=42334

NOTE: This is a candidate for stable branches

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
(cherry picked from commit f1a9a9bcd1)

Conflicts:

	src/mesa/main/teximage.h
2012-01-19 12:56:15 -08:00
Anuj Phogat
9b3ac17991 intel: Fix segfault in glXSwapBuffers with no bound context
Calling glXSwapBuffers with no bound context causes segmentation
fault in function intelDRI2Flush. All the gl calls should be
ignored after setting the current context to null. So the contents
of framebuffer stay unchanged. But the driver should not seg fault.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=44614

Reported-by: Yi Sun <yi.sun@intel.com>
Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Tested-by: Yi Sun <yi.sun@intel.com>
(cherry picked from commit dd7220652e)

Conflicts:

	src/mesa/drivers/dri/intel/intel_screen.c
2012-01-19 12:56:15 -08:00
Vinson Lee
d7d47d6c0b i965: Fix Coverity wrong sizeof argument defect.
NOTE: This is a candidate for stable release branches.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=42542
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit 3e18ad7fd7)
2012-01-19 12:56:15 -08:00
Paul Berry
29f07f6461 i965 gen4-6: Fix off-by-one errors brw_create_constant_surface()
Commit 9bdc44a528 (i965: Replace struct
with bit shifting for WM pull constant surfaces) accidentally
introduced off-by-one errors into the calculation of the surface
width, height, and depth.  This patch restores the correct
computation.

The reason this wasn't noticed by Piglit tests is that the size of our
constant surfaces is always less than 2^20, therefore the off-by-one
error was causing the "depth" field of the surface to be set to all
1's.  The hardware interpreted this as an extremely large surface, so
overflow checking was effectively disabled.

No Piglit regressions on Sandy Bridge.

NOTE: This is a candidate for the 7.11 and 8.0 branches.

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit f6f43bd5a2)
2012-01-19 12:56:15 -08:00
Brian Paul
1f18137d28 glw: s/lighgrey/lightgrey/
http://bugs.freedesktop.org/show_bug.cgi?id=44844
2012-01-16 15:07:23 -07:00
Ian Romanick
7722a54e60 glsl: Don't use base type for bit-not when there's an error
Other parts of the compiler assume that expressions will have
well-formed types or the error type.  Just using the type of the thing
being operated on can cause expressions like ~3.14 or ~false to not
have a well-formed type.  This could then result in an assertion
failure in the context epxression handler.

If there is an error processing the expression, set the type of the IR
expression to error.

Fixes piglit's bit-not-0[789].frag tests.

NOTE: This is a candidate for the 7.11 branch.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=42755
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Cc: Vinson Lee <vlee@vmware.com>
(cherry picked from commit 3946448951)
2012-01-04 12:44:49 -08:00
Ian Romanick
bc507471db glsl: Clamp vector indices when lowering to swizzles
This prevents other code from seeing a swizzle of the 16th component
of a vector, for example.

NOTE: This is a candidate for the 7.11 branch.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=42517
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Tested-by: Christian Holler <choller@mozilla.com>
(cherry picked from commit 6f5c737970)
2012-01-03 19:23:15 -08:00
Ian Romanick
42d1a7b3de glsl: Silence "ast_to_hir.cpp:1984:25: warning: comparison of unsigned expression >= 0 is always true"
ast_type_qualifier::location should have been a signed integer from
the beginning, and the giant comment in
apply_type_qualifier_to_variable explains why.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=40207
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit f0dd21ac88)
2011-12-22 17:01:53 -08:00
Marcin Slusarz
237d6fa97a nv50/nvc0: fix crash when channel allocation fails 2011-12-11 17:00:42 +01:00
Christoph Bumiller
0e9b79c22a nv50,nvc0: use screen instead of context for flush notifier
Context may become NULL and we still have to be able to flush
pending fences.

(Cherry picked from commit 3069a7eaa5)
Fixes crash on screen shutdown: https://bugs.freedesktop.org/show_bug.cgi?id=43428
2011-12-11 16:58:09 +01:00
Brian Paul
7a18f005ed gallivm: fix build with llvm 3.0svn
https://bugs.freedesktop.org/show_bug.cgi?id=41065
(cherry picked from commit 51002968c9)
2011-12-05 08:58:18 -07:00
Tobias Droste
95a3724c69 gallivm: fix build with LLVM 3.0svn
LLVM 3.0svn added SubtargetInfo as additional parameter to
createMCDisassembler() and createMCInstPrinter().
See revision 139237 of LLVM.

Signed-off-by: Tobias Droste <tdroste@gmx.de>
Signed-off-by: Brian Paul <brianp@vmware.com>
(cherry picked from commit 1795372fee)
2011-12-05 08:58:12 -07:00
Tobias Droste
98e8fb84de gallivm: fix build with LLVM 3.0svn
LLVM 3.0svn moved TargetRegistry.h and TargetSelect.h.
See revision 138450 of LLVM.

Signed-off-by: Tobias Droste <tdroste@gmx.de>
(cherry picked from commit 4a468de2d7)
2011-12-05 08:58:06 -07:00
Tobias Droste
5b5c436c65 llvmpipe: fix build with LLVM 3.0svn
LLVM 3.0svn introduced a new type system. It defines a new way to create
named structs and removes the (now not needed) LLVMInvalidateStructLayout
function.  See revision 134829 of LLVM.

Signed-off-by: Tobias Droste <tdroste@gmx.de>
Signed-off-by: Brian Paul <brianp@vmware.com>
(cherry picked from commit 3143e95353)
2011-12-05 08:58:00 -07:00
Vinson Lee
970df845ef gallivm: Rename createAsmInfo to createMCAsmInfo with llvm-3.0.
llvm-3.0svn r135219 renamed createAsmInfo to createMCAsmInfo in
include/llvm/Target/TargetRegistry.h.
(cherry picked from commit 9228bfb375)
2011-12-05 08:57:49 -07:00
Vinson Lee
32f4a83fe8 gallivm: Re-enable LLVMUnionTypeKind case for llvm-2.7 only.
LLVMUnionTypeKind is not in llvm-2.6, llvm-2.8, llvm-2.9, or llvm-3.0svn.
(cherry picked from commit 1844ae7e7e)
2011-12-05 08:57:42 -07:00
Vinson Lee
2c1998b3b9 gallivm: Remove LLVMOpaqueKindType case with llvm-3.0.
llvm-3.0svn r134829 removed LLVMOpaqueKindType from enum LLVMTypeKind in
include/llvm-c/Core.h.
(cherry picked from commit e4189f2e2e)
2011-12-05 08:57:11 -07:00
Vinson Lee
a3337a66ef gallivm: Rename TargetInstrDesc to MCInstrDesc when using llvm-3.0.
llvm-3.0svn revision 134021 renamed TargetInstrDesc to MCInstrDesc.
(cherry picked from commit b61e56756c)
2011-12-05 08:57:00 -07:00
Brian Paul
25ba654229 docs: update news, relnotes list for 7.11.2 release 2011-11-28 08:24:19 -07:00
Ian Romanick
733478975d docs: Add 7.11.2 release md5sums 2011-11-27 14:06:59 -08:00
Ian Romanick
ea72e3cda8 docs: Add 7.11.2 release notes 2011-11-27 14:04:48 -08:00
Ian Romanick
835205e295 mesa: Bump version to 7.11.2 (final) 2011-11-27 14:04:05 -08:00
Chad Versace
2a45566587 intel: Fix separate stencil in builtin DRI2 backend
intelAllocateBuffer() was oblivious to separate stencil buffers.  This
patch fixes it to allocate a non-tiled stencil buffer with special pitch,
just as the DDX does.

Without this, any app that attempted to create an EGL surface with stencil
bits would crash. Of course, this affected only environments that used the
builtin DRI2 backend, such as Android and Wayland.

Fixes GLBenchmark2.1 on Android on gen7.

Note: This is a candidate for the 7.11 branch.
Tested-by: Louie Tsaie <louie.tsai@intel.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
(cherry picked from commit 79653c12d6)

Conflicts:

	src/mesa/drivers/dri/intel/intel_screen.c
2011-11-21 16:11:50 -08:00
Chad Versace
68060d6bfd intel: Fix region dimensions for stencil buffers received from DDX
I changed the dimensions of the stencil buffer's region, as allocated by
the DDX, at xf86-video-intel commit
   commit 3e55f3e88b40471706d5cd45c4df4010f8675c75
   dri: Do not tile stencil buffer
But I forgot to make the analogous update to the Intel DRI2 glue in Mesa.
This patch makes that update.

Surprisingly, the mismatch did not cause any bugs. But the mismatch, if
left unfixed, *would* create bugs in the next commit.

Note: This is a candidate for the 7.11 branch.
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
(cherry picked from commit 50b3356078)
2011-11-21 16:10:49 -08:00
Chad Versace
fd35fab340 intel: Simplify stencil detiling arithmetic
When calculating the y offset needed for detiling window system stencil
buffers, replace the term
   region->height * 2 + region->height % 2 - 1
with
   rb->Height - 1 .

The two terms are incidentally equivalent due to some out-of-date,
incorrect code in the Intel DRI2 glue for DDX. (See
intel_process_dri2_buffer_with_separate_stencil(), line ``buffer_height /=
2;``).

Note: This is a candidate for the 7.11 branch (only the intel_span.c hunk).
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
(cherry picked from commit dc4c3a31c6)

Conflicts:

	src/mesa/drivers/dri/intel/intel_fbo.c
	src/mesa/drivers/dri/intel/intel_span.c
2011-11-21 16:10:22 -08:00
Brian Paul
658d994473 mesa: use format string in _mesa_error() call to silence warning
(cherry picked from commit 5485192fc8)
2011-11-21 19:49:48 +01:00
Brian Paul
8a8ccc00b5 docs: update news.html and relnotes.html for 7.11.1 release 2011-11-21 09:16:38 -07:00
Brian Paul
21364bd09d mesa: fix format selection for meta CopyTexSubImage()
When we do a glReadPixels into the temporary buffer, we don't want to
use GL_LUMINANCE, GL_LUMINANCE_ALPHA or GL_INTENSITY since they will
compute L=R+G+B which is not what we want.

This bug has existed all along but was only exposed by the elimination
of the driver hook for glCopyTexImage() in
5874890c26.

Fixes https://bugs.freedesktop.org/show_bug.cgi?id=39604
Tested-by: Ian Romanick <ian.d.romanick@intel.com>
(cherry picked from commit e4fdc95277)

(cherry-pick note: This patch and the one before it combine to fix
CopyTexImage from RGBA window to LA texture.  This was believed to
already be fixed by commit 296e6b9, but these changes were also
necessary.)
2011-11-18 12:18:19 -08:00
Brian Paul
6b2c771ddd mesa: stop using ctx->Driver.CopyTexImage1D/2D() hooks
(cherry picked from commit 5874890c26)
2011-11-18 12:12:22 -08:00
Ian Romanick
22ff4ec969 mesa: set version string to 7.11.2-devel 2011-11-18 11:06:33 -08:00
Ian Romanick
228da884c9 docs: Add 7.11.1 release md5sums 2011-11-17 12:12:34 -08:00
37 changed files with 440 additions and 128 deletions

View File

@@ -183,7 +183,7 @@ ultrix-gcc:
# Rules for making release tarballs
VERSION=7.11.1
VERSION=7.11.2
DIRECTORY = Mesa-$(VERSION)
LIB_NAME = MesaLib-$(VERSION)
GLUT_NAME = MesaGLUT-$(VERSION)

View File

@@ -75,13 +75,13 @@ AC_COMPILE_IFELSE(
not clang
#endif
]])],
[CLANG=yes], [CLANG=no])
[acv_mesa_CLANG=yes], [acv_mesa_CLANG=no])
AC_MSG_RESULT([$CLANG])
AC_MSG_RESULT([$acv_mesa_CLANG])
dnl If we're using GCC, make sure that it is at least version 3.3.0. Older
dnl versions are explictly not supported.
if test "x$GCC" = xyes -a "x$CLANG" = xno; then
if test "x$GCC" = xyes -a "x$acv_mesa_CLANG" = xno; then
AC_MSG_CHECKING([whether gcc version is sufficient])
major=0
minor=0

View File

@@ -11,6 +11,23 @@
<H1>News</H1>
<h2>November 27, 2011</h2>
<p>
<a href="relnotes-7.11.2.html">Mesa 7.11.2</a> is released.
This release was made primarily to fix build problems with 7.11.1 on
Mandriva and to fix problems related to glCopyTexImage to
luminance-alpha textures. That later was believed to have been fixed
in 7.11.1 but was not.
</p>
<h2>November 17, 2011</h2>
<p>
<a href="relnotes-7.11.1.html">Mesa 7.11.1</a> is released. This is a bug fix
release.
</p>
<h2>July 31, 2011</h2>
<p>

View File

@@ -28,10 +28,14 @@ for DRI hardware acceleration.
<h2>MD5 checksums</h2>
<pre>
TBD
ac0181a4076770fb657c1169af43aa09 MesaLib-7.11.1.tar.gz
a77307102cee844ff6544ffa8fafeac1 MesaLib-7.11.1.tar.bz2
dfcb11516c1730f3981b55a65a835623 MesaLib-7.11.1.zip
2cb2b9ecb4fb7d1a6be69346ee886952 MesaGLUT-7.11.1.tar.gz
3f54e314290d4dacbab089839197080b MesaGLUT-7.11.1.tar.bz2
5d66c7ee8c5cc2f27e1ffb037ad4172c MesaGLUT-7.11.1.zip
</pre>
<h2>New features</h2>
<p>None.</p>

85
docs/relnotes-7.11.2.html Normal file
View File

@@ -0,0 +1,85 @@
<HTML>
<head>
<TITLE>Mesa Release Notes</TITLE>
<link rel="stylesheet" type="text/css" href="mesa.css">
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
</head>
<BODY>
<body bgcolor="#eeeeee">
<H1>Mesa 7.11.2 Release Notes / November 27, 2011</H1>
<p>
Mesa 7.11.2 is a bug fix release which fixes bugs found since the 7.11 release.
</p>
<p>
Mesa 7.11 implements the OpenGL 2.1 API, but the version reported by
glGetString(GL_VERSION) depends on the particular driver being used.
Some drivers don't support all the features required in OpenGL 2.1.
</p>
<p>
See the <a href="install.html">Compiling/Installing page</a> for prerequisites
for DRI hardware acceleration.
</p>
<h2>MD5 checksums</h2>
<pre>
b9e84efee3931c0acbccd1bb5a860554 MesaLib-7.11.2.tar.gz
0837c52698fe3252369c3fdb5195afcc MesaLib-7.11.2.tar.bz2
141273c274d12e0d2bafb497fe937da3 MesaLib-7.11.2.zip
39ae9926794794503815ffdc069521eb MesaGLUT-7.11.2.tar.gz
35ca3a0b54cb6f9d2e0e4eae8f6bb95e MesaGLUT-7.11.2.tar.bz2
f8705fcff2510b6c39cd27b575c05dba MesaGLUT-7.11.2.zip
</pre>
<h2>New features</h2>
<p>None.</p>
<h2>Bug fixes</h2>
<p>This list is likely incomplete.</p>
<ul>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=43143">Bug 43143</a> - Mesa 7.11.1 fails to build at main/dlist.c:4532 with error message: "format not a string literal and no format arguments"</li>
<li>Incorrect handling of CopyTexImage from RGBA window to LA texture.</li>
<!-- <li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=">Bug </a> - </li> -->
</ul>
<h2>Changes</h2>
<p>The full set of changes can be viewed by using the following GIT command:</p>
<pre>
git log mesa-7.11.1..mesa-7.11.2
</pre>
<p>Brian Paul (4):
<ul>
<li>mesa: stop using ctx-&gt;Driver.CopyTexImage1D/2D() hooks</li>
<li>mesa: fix format selection for meta CopyTexSubImage()</li>
<li>docs: update news.html and relnotes.html for 7.11.1 release</li>
<li>mesa: use format string in _mesa_error() call to silence warning</li>
</ul></p>
<p>Chad Versace (3):
<ul>
<li>intel: Simplify stencil detiling arithmetic</li>
<li>intel: Fix region dimensions for stencil buffers received from DDX</li>
<li>intel: Fix separate stencil in builtin DRI2 backend</li>
</ul></p>
<p>Ian Romanick (3):
<ul>
<li>docs: Add 7.11.1 release md5sums</li>
<li>mesa: set version string to 7.11.2-devel</li>
<li>mesa: Bump version to 7.11.2 (final)</li>
</ul></p>
</body>
</html>

View File

@@ -13,6 +13,8 @@ The release notes summarize what's new or changed in each Mesa release.
</p>
<UL>
<LI><A HREF="relnotes-7.11.2.html">7.11.2 release notes</A>
<LI><A HREF="relnotes-7.11.1.html">7.11.1 release notes</A>
<LI><A HREF="relnotes-7.11.html">7.11 release notes</A>
<LI><A HREF="relnotes-7.10.3.html">7.10.3 release notes</A>
<LI><A HREF="relnotes-7.10.2.html">7.10.2 release notes</A>

View File

@@ -96,7 +96,7 @@ draw_llvm_generate_elts(struct draw_llvm *llvm, struct draw_llvm_variant *var);
* Create LLVM type for struct draw_jit_texture
*/
static LLVMTypeRef
create_jit_texture_type(struct gallivm_state *gallivm)
create_jit_texture_type(struct gallivm_state *gallivm, const char *struct_name)
{
LLVMTargetDataRef target = gallivm->target;
LLVMTypeRef texture_type;
@@ -120,13 +120,21 @@ create_jit_texture_type(struct gallivm_state *gallivm)
elem_types[DRAW_JIT_TEXTURE_BORDER_COLOR] =
LLVMArrayType(LLVMFloatTypeInContext(gallivm->context), 4);
#if HAVE_LLVM >= 0x0300
texture_type = LLVMStructCreateNamed(gallivm->context, struct_name);
LLVMStructSetBody(texture_type, elem_types,
Elements(elem_types), 0);
#else
texture_type = LLVMStructTypeInContext(gallivm->context, elem_types,
Elements(elem_types), 0);
LLVMAddTypeName(gallivm->module, struct_name, texture_type);
/* Make sure the target's struct layout cache doesn't return
* stale/invalid data.
*/
LLVMInvalidateStructLayout(gallivm->target, texture_type);
#endif
LP_CHECK_MEMBER_OFFSET(struct draw_jit_texture, width,
target, texture_type,
@@ -176,7 +184,7 @@ create_jit_texture_type(struct gallivm_state *gallivm)
*/
static LLVMTypeRef
create_jit_context_type(struct gallivm_state *gallivm,
LLVMTypeRef texture_type)
LLVMTypeRef texture_type, const char *struct_name)
{
LLVMTargetDataRef target = gallivm->target;
LLVMTypeRef float_type = LLVMFloatTypeInContext(gallivm->context);
@@ -189,11 +197,17 @@ create_jit_context_type(struct gallivm_state *gallivm,
elem_types[3] = LLVMPointerType(float_type, 0); /* viewport */
elem_types[4] = LLVMArrayType(texture_type,
PIPE_MAX_VERTEX_SAMPLERS); /* textures */
#if HAVE_LLVM >= 0x0300
context_type = LLVMStructCreateNamed(gallivm->context, struct_name);
LLVMStructSetBody(context_type, elem_types,
Elements(elem_types), 0);
#else
context_type = LLVMStructTypeInContext(gallivm->context, elem_types,
Elements(elem_types), 0);
LLVMAddTypeName(gallivm->module, struct_name, context_type);
LLVMInvalidateStructLayout(gallivm->target, context_type);
#endif
LP_CHECK_MEMBER_OFFSET(struct draw_jit_context, vs_constants,
target, context_type, 0);
@@ -215,7 +229,7 @@ create_jit_context_type(struct gallivm_state *gallivm,
* Create LLVM type for struct pipe_vertex_buffer
*/
static LLVMTypeRef
create_jit_vertex_buffer_type(struct gallivm_state *gallivm)
create_jit_vertex_buffer_type(struct gallivm_state *gallivm, const char *struct_name)
{
LLVMTargetDataRef target = gallivm->target;
LLVMTypeRef elem_types[3];
@@ -225,10 +239,17 @@ create_jit_vertex_buffer_type(struct gallivm_state *gallivm)
elem_types[1] = LLVMInt32TypeInContext(gallivm->context);
elem_types[2] = LLVMPointerType(LLVMInt8TypeInContext(gallivm->context), 0); /* vs_constants */
#if HAVE_LLVM >= 0x0300
vb_type = LLVMStructCreateNamed(gallivm->context, struct_name);
LLVMStructSetBody(vb_type, elem_types,
Elements(elem_types), 0);
#else
vb_type = LLVMStructTypeInContext(gallivm->context, elem_types,
Elements(elem_types), 0);
LLVMAddTypeName(gallivm->module, struct_name, vb_type);
LLVMInvalidateStructLayout(gallivm->target, vb_type);
#endif
LP_CHECK_MEMBER_OFFSET(struct pipe_vertex_buffer, stride,
target, vb_type, 0);
@@ -258,10 +279,17 @@ create_jit_vertex_header(struct gallivm_state *gallivm, int data_elems)
elem_types[1] = LLVMArrayType(LLVMFloatTypeInContext(gallivm->context), 4);
elem_types[2] = LLVMArrayType(elem_types[1], data_elems);
#if HAVE_LLVM >= 0x0300
vertex_header = LLVMStructCreateNamed(gallivm->context, struct_name);
LLVMStructSetBody(vertex_header, elem_types,
Elements(elem_types), 0);
#else
vertex_header = LLVMStructTypeInContext(gallivm->context, elem_types,
Elements(elem_types), 0);
LLVMAddTypeName(gallivm->module, struct_name, vertex_header);
LLVMInvalidateStructLayout(gallivm->target, vertex_header);
#endif
/* these are bit-fields and we can't take address of them
LP_CHECK_MEMBER_OFFSET(struct vertex_header, clipmask,
@@ -284,8 +312,6 @@ create_jit_vertex_header(struct gallivm_state *gallivm, int data_elems)
target, vertex_header,
DRAW_JIT_VERTEX_DATA);
LLVMAddTypeName(gallivm->module, struct_name, vertex_header);
return vertex_header;
}
@@ -299,19 +325,15 @@ create_jit_types(struct draw_llvm *llvm)
struct gallivm_state *gallivm = llvm->gallivm;
LLVMTypeRef texture_type, context_type, buffer_type, vb_type;
texture_type = create_jit_texture_type(gallivm);
LLVMAddTypeName(gallivm->module, "texture", texture_type);
texture_type = create_jit_texture_type(gallivm, "texture");
context_type = create_jit_context_type(gallivm, texture_type);
LLVMAddTypeName(gallivm->module, "draw_jit_context", context_type);
context_type = create_jit_context_type(gallivm, texture_type, "draw_jit_context");
llvm->context_ptr_type = LLVMPointerType(context_type, 0);
buffer_type = LLVMPointerType(LLVMIntTypeInContext(gallivm->context, 8), 0);
LLVMAddTypeName(gallivm->module, "buffer", buffer_type);
llvm->buffer_ptr_type = LLVMPointerType(buffer_type, 0);
vb_type = create_jit_vertex_buffer_type(gallivm);
LLVMAddTypeName(gallivm->module, "pipe_vertex_buffer", vb_type);
vb_type = create_jit_vertex_buffer_type(gallivm, "pipe_vertex_buffer");
llvm->vb_ptr_type = LLVMPointerType(vb_type, 0);
}

View File

@@ -27,17 +27,23 @@
#include <llvm-c/Core.h>
#include <llvm/Target/TargetMachine.h>
#include <llvm/Target/TargetRegistry.h>
#include <llvm/Target/TargetSelect.h>
#include <llvm/Target/TargetInstrInfo.h>
#include <llvm/Support/raw_ostream.h>
#include <llvm/Support/MemoryObject.h>
#if HAVE_LLVM >= 0x0300
#include <llvm/Support/TargetRegistry.h>
#include <llvm/Support/TargetSelect.h>
#else /* HAVE_LLVM < 0x0300 */
#include <llvm/Target/TargetRegistry.h>
#include <llvm/Target/TargetSelect.h>
#endif /* HAVE_LLVM < 0x0300 */
#if HAVE_LLVM >= 0x0209
#include <llvm/Support/Host.h>
#else
#else /* HAVE_LLVM < 0x0209 */
#include <llvm/System/Host.h>
#endif
#endif /* HAVE_LLVM < 0x0209 */
#if HAVE_LLVM >= 0x0207
#include <llvm/MC/MCDisassembler.h>
@@ -193,14 +199,23 @@ lp_disassemble(const void* func)
InitializeAllDisassemblers();
#if HAVE_LLVM >= 0x0300
OwningPtr<const MCAsmInfo> AsmInfo(T->createMCAsmInfo(Triple));
#else
OwningPtr<const MCAsmInfo> AsmInfo(T->createAsmInfo(Triple));
#endif
if (!AsmInfo) {
debug_printf("error: no assembly info for target %s\n", Triple.c_str());
return;
}
#if HAVE_LLVM >= 0x0300
const MCSubtargetInfo *STI = T->createMCSubtargetInfo(Triple, sys::getHostCPUName(), "");
OwningPtr<const MCDisassembler> DisAsm(T->createMCDisassembler(*STI));
#else
OwningPtr<const MCDisassembler> DisAsm(T->createMCDisassembler());
#endif
if (!DisAsm) {
debug_printf("error: no disassembler for target %s\n", Triple.c_str());
return;
@@ -213,7 +228,11 @@ lp_disassemble(const void* func)
#else
int AsmPrinterVariant = AsmInfo->getAssemblerDialect();
#endif
#if HAVE_LLVM >= 0x0208
#if HAVE_LLVM >= 0x0300
OwningPtr<MCInstPrinter> Printer(
T->createMCInstPrinter(AsmPrinterVariant, *AsmInfo, *STI));
#elif HAVE_LLVM >= 0x0208
OwningPtr<MCInstPrinter> Printer(
T->createMCInstPrinter(AsmPrinterVariant, *AsmInfo));
#else
@@ -253,7 +272,11 @@ lp_disassemble(const void* func)
if (!DisAsm->getInstruction(Inst, Size, memoryObject,
pc,
nulls())) {
#if HAVE_LLVM >= 0x0300
nulls(), nulls())) {
#else
nulls())) {
#endif
debug_printf("invalid\n");
pc += 1;
}
@@ -276,7 +299,9 @@ lp_disassemble(const void* func)
* Print the instruction.
*/
#if HAVE_LLVM >= 0x208
#if HAVE_LLVM >= 0x0300
Printer->printInst(&Inst, Out, "");
#elif HAVE_LLVM >= 0x208
Printer->printInst(&Inst, Out);
#else
Printer->printInst(&Inst);
@@ -289,7 +314,11 @@ lp_disassemble(const void* func)
pc += Size;
#if HAVE_LLVM >= 0x0300
const MCInstrDesc &TID = TII->get(Inst.getOpcode());
#else
const TargetInstrDesc &TID = TII->get(Inst.getOpcode());
#endif
/*
* Keep track of forward jumps to a nearby address.

View File

@@ -325,16 +325,18 @@ lp_typekind_name(LLVMTypeKind t)
return "LLVMArrayTypeKind";
case LLVMPointerTypeKind:
return "LLVMPointerTypeKind";
#if HAVE_LLVM < 0x0300
case LLVMOpaqueTypeKind:
return "LLVMOpaqueTypeKind";
#endif
case LLVMVectorTypeKind:
return "LLVMVectorTypeKind";
case LLVMMetadataTypeKind:
return "LLVMMetadataTypeKind";
/* Only in LLVM 2.7 and later???
#if HAVE_LLVM == 0x0207
case LLVMUnionTypeKind:
return "LLVMUnionTypeKind";
*/
#endif
default:
return "unknown LLVMTypeKind";
}

View File

@@ -68,10 +68,17 @@ lp_jit_create_types(struct llvmpipe_context *lp)
elem_types[LP_JIT_TEXTURE_BORDER_COLOR] =
LLVMArrayType(LLVMFloatTypeInContext(lc), 4);
#if HAVE_LLVM >= 0x0300
texture_type = LLVMStructCreateNamed(gallivm->context, "texture");
LLVMStructSetBody(texture_type, elem_types,
Elements(elem_types), 0);
#else
texture_type = LLVMStructTypeInContext(lc, elem_types,
Elements(elem_types), 0);
LLVMAddTypeName(gallivm->module, "texture", texture_type);
LLVMInvalidateStructLayout(gallivm->target, texture_type);
#endif
LP_CHECK_MEMBER_OFFSET(struct lp_jit_texture, width,
gallivm->target, texture_type,
@@ -112,8 +119,6 @@ lp_jit_create_types(struct llvmpipe_context *lp)
LP_CHECK_STRUCT_SIZE(struct lp_jit_texture,
gallivm->target, texture_type);
LLVMAddTypeName(gallivm->module, "texture", texture_type);
}
/* struct lp_jit_context */
@@ -129,11 +134,19 @@ lp_jit_create_types(struct llvmpipe_context *lp)
elem_types[LP_JIT_CTX_TEXTURES] = LLVMArrayType(texture_type,
PIPE_MAX_SAMPLERS);
#if HAVE_LLVM >= 0x0300
context_type = LLVMStructCreateNamed(gallivm->context, "context");
LLVMStructSetBody(context_type, elem_types,
Elements(elem_types), 0);
#else
context_type = LLVMStructTypeInContext(lc, elem_types,
Elements(elem_types), 0);
LLVMInvalidateStructLayout(gallivm->target, context_type);
LLVMAddTypeName(gallivm->module, "context", context_type);
#endif
LP_CHECK_MEMBER_OFFSET(struct lp_jit_context, constants,
gallivm->target, context_type,
LP_JIT_CTX_CONSTANTS);
@@ -155,8 +168,6 @@ lp_jit_create_types(struct llvmpipe_context *lp)
LP_CHECK_STRUCT_SIZE(struct lp_jit_context,
gallivm->target, context_type);
LLVMAddTypeName(gallivm->module, "context", context_type);
lp->jit_context_ptr_type = LLVMPointerType(context_type, 0);
}

View File

@@ -60,13 +60,13 @@ nv50_texture_barrier(struct pipe_context *pipe)
void
nv50_default_flush_notify(struct nouveau_channel *chan)
{
struct nv50_context *nv50 = chan->user_private;
struct nv50_screen *screen = chan->user_private;
if (!nv50)
if (!screen)
return;
nouveau_fence_update(&nv50->screen->base, TRUE);
nouveau_fence_next(&nv50->screen->base);
nouveau_fence_update(&screen->base, TRUE);
nouveau_fence_next(&screen->base);
}
static void
@@ -100,10 +100,8 @@ nv50_destroy(struct pipe_context *pipe)
draw_destroy(nv50->draw);
if (nv50->screen->cur_ctx == nv50) {
nv50->screen->base.channel->user_private = NULL;
if (nv50->screen->cur_ctx == nv50)
nv50->screen->cur_ctx = NULL;
}
FREE(nv50);
}
@@ -140,7 +138,6 @@ nv50_create(struct pipe_screen *pscreen, void *priv)
if (!screen->cur_ctx)
screen->cur_ctx = nv50;
screen->base.channel->user_private = nv50;
screen->base.channel->flush_notify = nv50_default_flush_notify;
nv50_init_query_functions(nv50);

View File

@@ -215,6 +215,8 @@ nv50_screen_destroy(struct pipe_screen *pscreen)
nouveau_fence_wait(screen->base.fence.current);
nouveau_fence_ref (NULL, &screen->base.fence.current);
}
if (screen->base.channel)
screen->base.channel->user_private = NULL;
nouveau_bo_ref(NULL, &screen->code);
nouveau_bo_ref(NULL, &screen->tls_bo);
@@ -304,6 +306,7 @@ nv50_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev)
FAIL_SCREEN_INIT("nouveau_screen_init failed: %d\n", ret);
chan = screen->base.channel;
chan->user_private = screen;
pscreen->winsys = ws;
pscreen->destroy = nv50_screen_destroy;

View File

@@ -282,8 +282,7 @@ nv50_switch_pipe_context(struct nv50_context *ctx_to)
if (!ctx_to->zsa)
ctx_to->dirty &= ~NV50_NEW_ZSA;
ctx_to->screen->base.channel->user_private = ctx_to->screen->cur_ctx =
ctx_to;
ctx_to->screen->cur_ctx = ctx_to;
}
static struct state_validate {

View File

@@ -389,11 +389,11 @@ nv50_prim_gl(unsigned prim)
static void
nv50_draw_vbo_flush_notify(struct nouveau_channel *chan)
{
struct nv50_context *nv50 = chan->user_private;
struct nv50_screen *screen = chan->user_private;
nouveau_fence_update(&nv50->screen->base, TRUE);
nouveau_fence_update(&screen->base, TRUE);
nv50_bufctx_emit_relocs(nv50);
nv50_bufctx_emit_relocs(screen->cur_ctx);
}
static void
@@ -650,7 +650,6 @@ nv50_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info)
nv50_state_validate(nv50);
chan->flush_notify = nv50_draw_vbo_flush_notify;
chan->user_private = nv50;
if (nv50->vbo_fifo) {
nv50_push_vbo(nv50, info);

View File

@@ -89,10 +89,8 @@ nvc0_destroy(struct pipe_context *pipe)
draw_destroy(nvc0->draw);
if (nvc0->screen->cur_ctx == nvc0) {
nvc0->screen->base.channel->user_private = NULL;
if (nvc0->screen->cur_ctx == nvc0)
nvc0->screen->cur_ctx = NULL;
}
FREE(nvc0);
}
@@ -100,13 +98,13 @@ nvc0_destroy(struct pipe_context *pipe)
void
nvc0_default_flush_notify(struct nouveau_channel *chan)
{
struct nvc0_context *nvc0 = chan->user_private;
struct nvc0_screen *screen = chan->user_private;
if (!nvc0)
if (!screen)
return;
nouveau_fence_update(&nvc0->screen->base, TRUE);
nouveau_fence_next(&nvc0->screen->base);
nouveau_fence_update(&screen->base, TRUE);
nouveau_fence_next(&screen->base);
}
struct pipe_context *
@@ -141,7 +139,6 @@ nvc0_create(struct pipe_screen *pscreen, void *priv)
if (!screen->cur_ctx)
screen->cur_ctx = nvc0;
screen->base.channel->user_private = nvc0;
screen->base.channel->flush_notify = nvc0_default_flush_notify;
nvc0_init_query_functions(nvc0);

View File

@@ -198,8 +198,12 @@ nvc0_screen_destroy(struct pipe_screen *pscreen)
{
struct nvc0_screen *screen = nvc0_screen(pscreen);
nouveau_fence_wait(screen->base.fence.current);
nouveau_fence_ref(NULL, &screen->base.fence.current);
if (screen->base.fence.current) {
nouveau_fence_wait(screen->base.fence.current);
nouveau_fence_ref(NULL, &screen->base.fence.current);
}
if (screen->base.channel)
screen->base.channel->user_private = NULL;
nouveau_bo_ref(NULL, &screen->text);
nouveau_bo_ref(NULL, &screen->tls);
@@ -362,6 +366,7 @@ nvc0_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev)
return NULL;
}
chan = screen->base.channel;
chan->user_private = screen;
pscreen->winsys = ws;
pscreen->destroy = nvc0_screen_destroy;

View File

@@ -428,8 +428,7 @@ nvc0_switch_pipe_context(struct nvc0_context *ctx_to)
if (!ctx_to->zsa)
ctx_to->dirty &= ~NVC0_NEW_ZSA;
ctx_to->screen->base.channel->user_private = ctx_to->screen->cur_ctx =
ctx_to;
ctx_to->screen->cur_ctx = ctx_to;
}
static struct state_validate {

View File

@@ -367,11 +367,11 @@ nvc0_prim_gl(unsigned prim)
static void
nvc0_draw_vbo_flush_notify(struct nouveau_channel *chan)
{
struct nvc0_context *nvc0 = chan->user_private;
struct nvc0_screen *screen = chan->user_private;
nouveau_fence_update(&nvc0->screen->base, TRUE);
nouveau_fence_update(&screen->base, TRUE);
nvc0_bufctx_emit_relocs(nvc0);
nvc0_bufctx_emit_relocs(screen->cur_ctx);
}
static void
@@ -587,7 +587,6 @@ nvc0_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info)
nvc0_state_validate(nvc0);
chan->flush_notify = nvc0_draw_vbo_flush_notify;
chan->user_private = nvc0;
if (nvc0->vbo_fifo) {
nvc0_push_vbo(nvc0, info);

View File

@@ -372,7 +372,7 @@ struct ast_type_qualifier {
* \note
* This field is only valid if \c explicit_location is set.
*/
unsigned location;
int location;
/**
* Return true if and only if an interpolation qualifier is present.

View File

@@ -1140,7 +1140,7 @@ ast_expression::hir(exec_list *instructions,
error_emitted = true;
}
type = op[0]->type;
type = error_emitted ? glsl_type::error_type : op[0]->type;
result = new(ctx) ir_expression(ir_unop_bit_not, type, op[0], NULL);
break;

View File

@@ -33,6 +33,7 @@
#include "ir_visitor.h"
#include "ir_optimization.h"
#include "glsl_types.h"
#include "main/macros.h"
/**
* Visitor class for replacing expressions with ir_constant values.
@@ -76,8 +77,25 @@ ir_vec_index_to_swizzle_visitor::convert_vec_index_to_swizzle(ir_rvalue *ir)
void *ctx = ralloc_parent(ir);
this->progress = true;
return new(ctx) ir_swizzle(deref->array,
ir_constant->value.i[0], 0, 0, 0, 1);
/* Page 40 of the GLSL 1.20 spec says:
*
* "When indexing with non-constant expressions, behavior is undefined
* if the index is negative, or greater than or equal to the size of
* the vector."
*
* The quoted spec text mentions non-constant expressions, but this code
* operates on constants. These constants are the result of non-constant
* expressions that have been optimized to constants. The common case here
* is a loop counter from an unrolled loop that is used to index a vector.
*
* The ir_swizzle constructor gets angry if the index is negative or too
* large. For simplicity sake, just clamp the index to [0, size-1].
*/
const int i = MIN2(MAX2(ir_constant->value.i[0], 0),
(deref->array->type->vector_elements - 1));
return new(ctx) ir_swizzle(deref->array, i, 0, 0, 0, 1);
}
ir_visitor_status

View File

@@ -270,7 +270,7 @@ static XtResource backgroundResources[] = {
static XtResource otherColorResources[] = {
{XmNforeground,XmCForeground,XmRPixel,
sizeof(Pixel),XtOffset(GLwDrawingAreaWidget,primitive.foreground),
XmRString,(XtPointer)"lighgrey"},
XmRString,(XtPointer)"lightgrey"},
/*XmRCallProc, (XtPointer) _XmForegroundColorDefault},*/
{XmNhighlightColor,XmCHighlightColor,XmRPixel,sizeof(Pixel),

View File

@@ -135,6 +135,7 @@ release_drawable(struct apple_glx_drawable *d)
static bool
destroy_drawable(struct apple_glx_drawable *d)
{
int err;
d->lock(d);
@@ -172,6 +173,15 @@ destroy_drawable(struct apple_glx_drawable *d)
apple_glx_diagnostic("%s: freeing %p\n", __func__, (void *) d);
/* Stupid recursive locks */
while (pthread_mutex_unlock(&d->mutex) == 0);
err = pthread_mutex_destroy(&d->mutex);
if (err) {
fprintf(stderr, "pthread_mutex_destroy error: %s\n", strerror(err));
abort();
}
free(d);
/* So that the locks are balanced and the caller correctly unlocks. */

View File

@@ -206,6 +206,7 @@ apple_glx_surface_destroy(unsigned int uid)
if (d) {
d->types.surface.pending_destroy = true;
d->release(d);
/*
* We release 2 references to the surface. One was acquired by
* the find, and the other was leftover from a context, or
@@ -216,8 +217,9 @@ apple_glx_surface_destroy(unsigned int uid)
* to actually destroy it when the pending_destroy is processed
* by a glViewport callback (see apple_glx_context_update()).
*/
d->destroy(d);
d->unlock(d);
if (!d->destroy(d)) {
/* apple_glx_drawable_find_by_uid returns a locked drawable */
d->unlock(d);
}
}
}

View File

@@ -116,7 +116,7 @@ apple_visual_create_pfobj(CGLPixelFormatObj * pfobj, const struct glx_config * m
*uses_stereo = false;
}
if (mode->doubleBufferMode) {
if (!offscreen && mode->doubleBufferMode) {
attr[numattr++] = kCGLPFADoubleBuffer;
*double_buffered = true;
}

View File

@@ -77,7 +77,7 @@ __glapi_gentable_set_remaining_noop(struct _glapi_table *disp) {
struct _glapi_table *
_glapi_create_table_from_handle(void *handle, const char *symbol_prefix) {
struct _glapi_table *disp = calloc(1, sizeof(struct _glapi_table));
struct _glapi_table *disp = calloc(_glapi_get_dispatch_table_size(), sizeof(void *));
char symboln[512];
if(!disp)

View File

@@ -2842,6 +2842,16 @@ copy_tex_sub_image(struct gl_context *ctx,
/* Choose format/type for temporary image buffer */
format = _mesa_get_format_base_format(texImage->TexFormat);
if (format == GL_LUMINANCE ||
format == GL_LUMINANCE_ALPHA ||
format == GL_INTENSITY) {
/* We don't want to use GL_LUMINANCE, GL_INTENSITY, etc. for the
* temp image buffer because glReadPixels will do L=R+G+B which is
* not what we want (should be L=R).
*/
format = GL_RGBA;
}
type = get_temp_image_type(ctx, format);
bpp = _mesa_bytes_per_pixel(format, type);
if (bpp <= 0) {

View File

@@ -283,10 +283,10 @@ brw_create_constant_surface(struct brw_context *brw,
surf[1] = bo->offset; /* reloc */
surf[2] = (((w & 0x7f) - 1) << BRW_SURFACE_WIDTH_SHIFT |
(((w >> 7) & 0x1fff) - 1) << BRW_SURFACE_HEIGHT_SHIFT);
surf[2] = ((w & 0x7f) << BRW_SURFACE_WIDTH_SHIFT |
((w >> 7) & 0x1fff) << BRW_SURFACE_HEIGHT_SHIFT);
surf[3] = ((((w >> 20) & 0x7f) - 1) << BRW_SURFACE_DEPTH_SHIFT |
surf[3] = (((w >> 20) & 0x7f) << BRW_SURFACE_DEPTH_SHIFT |
(width * 16 - 1) << BRW_SURFACE_PITCH_SHIFT);
surf[4] = 0;

View File

@@ -36,7 +36,7 @@ prepare_sf_clip_viewport(struct brw_context *brw)
const GLfloat *v = ctx->Viewport._WindowMap.m;
struct gen7_sf_clip_viewport *vp;
vp = brw_state_batch(brw, sizeof(vp), 64, &brw->sf.vp_offset);
vp = brw_state_batch(brw, sizeof(*vp), 64, &brw->sf.vp_offset);
/* Also assign to clip.vp_offset in case something uses it. */
brw->clip.vp_offset = brw->sf.vp_offset;

View File

@@ -1334,27 +1334,28 @@ intel_process_dri2_buffer_with_separate_stencil(struct intel_context *intel,
buffer->cpp, buffer->pitch);
}
/*
* The stencil buffer has quirky pitch requirements. From Section
* 2.11.5.6.2.1 3DSTATE_STENCIL_BUFFER, field "Surface Pitch":
* The pitch must be set to 2x the value computed based on width, as
* the stencil buffer is stored with two rows interleaved.
* If we neglect to double the pitch, then drm_intel_gem_bo_map_gtt()
* maps the memory incorrectly.
*
* To satisfy the pitch requirement, the X driver hackishly allocated
* the gem buffer with bpp doubled and height halved. So buffer->cpp is
* correct, but drawable->height is not.
*/
int buffer_height = drawable->h;
int buffer_width;
int buffer_height;
if (buffer->attachment == __DRI_BUFFER_STENCIL) {
buffer_height /= 2;
/* The stencil buffer has quirky pitch requirements. From Section
* 2.11.5.6.2.1 3DSTATE_STENCIL_BUFFER, field "Surface Pitch":
* The pitch must be set to 2x the value computed based on width, as
* the stencil buffer is stored with two rows interleaved.
*
* To satisfy the pitch requirement, the X driver allocated the region
* with the following dimensions.
*/
buffer_width = ALIGN(drawable->w, 64);
buffer_height = ALIGN(ALIGN(drawable->h, 2) / 2, 64);
} else {
buffer_width = drawable->w;
buffer_height = drawable->h;
}
struct intel_region *region =
intel_region_alloc_for_handle(intel->intelScreen,
buffer->cpp,
drawable->w,
buffer_width,
buffer_height,
buffer->pitch / buffer->cpp,
buffer->name,

View File

@@ -108,13 +108,15 @@ intelDRI2Flush(__DRIdrawable *drawable)
GET_CURRENT_CONTEXT(ctx);
struct intel_context *intel = intel_context(ctx);
if (intel->gen < 4)
INTEL_FIREVERTICES(intel);
if (intel != NULL) {
if (intel->gen < 4)
INTEL_FIREVERTICES(intel);
intel->need_throttle = GL_TRUE;
intel->need_throttle = GL_TRUE;
if (intel->batch.used)
intel_batchbuffer_flush(intel);
if (intel->batch.used)
intel_batchbuffer_flush(intel);
}
}
static const struct __DRI2flushExtensionRec intelFlushExtension = {
@@ -785,6 +787,54 @@ struct intel_buffer {
struct intel_region *region;
};
/**
* \brief Get tiling format for a DRI buffer.
*
* \param attachment is the buffer's attachmet point, such as
* __DRI_BUFFER_DEPTH.
* \param out_tiling is the returned tiling format for buffer.
* \return false if attachment is unrecognized or is incompatible with screen.
*/
static bool
intel_get_dri_buffer_tiling(struct intel_screen *screen,
uint32_t attachment,
uint32_t *out_tiling)
{
if (screen->gen < 4) {
*out_tiling = I915_TILING_X;
return true;
}
switch (attachment) {
case __DRI_BUFFER_DEPTH:
case __DRI_BUFFER_DEPTH_STENCIL:
case __DRI_BUFFER_HIZ:
*out_tiling = I915_TILING_Y;
return true;
case __DRI_BUFFER_ACCUM:
case __DRI_BUFFER_FRONT_LEFT:
case __DRI_BUFFER_FRONT_RIGHT:
case __DRI_BUFFER_BACK_LEFT:
case __DRI_BUFFER_BACK_RIGHT:
case __DRI_BUFFER_FAKE_FRONT_LEFT:
case __DRI_BUFFER_FAKE_FRONT_RIGHT:
*out_tiling = I915_TILING_X;
return true;
case __DRI_BUFFER_STENCIL:
/* The stencil buffer is W tiled. However, we request from the kernel
* a non-tiled buffer because the GTT is incapable of W fencing.
*/
*out_tiling = I915_TILING_NONE;
return true;
default:
if(unlikely(INTEL_DEBUG & DEBUG_DRI)) {
fprintf(stderr, "error: %s: unrecognized DRI buffer attachment 0x%x\n",
__FUNCTION__, attachment);
}
return false;
}
}
static __DRIbuffer *
intelAllocateBuffer(__DRIscreen *screen,
unsigned attachment, unsigned format,
@@ -792,22 +842,45 @@ intelAllocateBuffer(__DRIscreen *screen,
{
struct intel_buffer *intelBuffer;
struct intel_screen *intelScreen = screen->private;
uint32_t tiling;
uint32_t region_width;
uint32_t region_height;
uint32_t region_cpp;
bool ok = true;
ok = intel_get_dri_buffer_tiling(intelScreen, attachment, &tiling);
if (!ok)
return NULL;
intelBuffer = CALLOC(sizeof *intelBuffer);
if (intelBuffer == NULL)
return NULL;
if ((attachment == __DRI_BUFFER_DEPTH ||
attachment == __DRI_BUFFER_STENCIL ||
attachment == __DRI_BUFFER_DEPTH_STENCIL) &&
intelScreen->gen >= 4)
tiling = I915_TILING_Y;
else
tiling = I915_TILING_X;
if (attachment == __DRI_BUFFER_STENCIL) {
/* The stencil buffer has quirky pitch requirements. From Vol 2a,
* 11.5.6.2.1 3DSTATE_STENCIL_BUFFER, field "Surface Pitch":
* The pitch must be set to 2x the value computed based on width, as
* the stencil buffer is stored with two rows interleaved.
* To accomplish this, we resort to the nasty hack of doubling the
* region's cpp and halving its height.
*/
region_width = ALIGN(width, 64);
region_height = ALIGN(ALIGN(height, 2) / 2, 64);
region_cpp = format / 4;
} else {
region_width = width;
region_height = height;
region_cpp = format / 8;
}
intelBuffer->region = intel_region_alloc(intelScreen, tiling,
format / 8, width, height, GL_TRUE);
intelBuffer->region = intel_region_alloc(intelScreen,
tiling,
region_cpp,
region_width,
region_height,
true);
if (intelBuffer->region == NULL) {
FREE(intelBuffer);

View File

@@ -141,10 +141,9 @@ intel_set_span_functions(struct intel_context *intel,
struct intel_renderbuffer *irb = intel_renderbuffer(rb); \
uint8_t *buf = irb->region->buffer->virtual; \
unsigned stride = irb->region->pitch; \
unsigned height = 2 * irb->region->height; \
bool flip = rb->Name == 0; \
int y_scale = flip ? -1 : 1; \
int y_bias = flip ? (height - 1) : 0; \
int y_bias = flip ? (rb->Height - 1) : 0; \
#undef Y_FLIP
#define Y_FLIP(y) (y_scale * (y) + y_bias)

View File

@@ -4529,7 +4529,7 @@ static GLvoid *copy_data(const GLvoid *data, GLsizei size, const char *func)
image = malloc(size);
if (!image) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, func);
_mesa_error(ctx, GL_OUT_OF_MEMORY, "%s", func);
return NULL;
}
memcpy(image, data, size);

View File

@@ -713,6 +713,9 @@ _mesa_GetnTexImageARB( GLenum target, GLint level, GLenum format,
texObj = _mesa_get_current_tex_object(ctx, target);
texImage = _mesa_select_tex_image(ctx, texObj, target, level);
if (_mesa_is_zero_size_texture(texImage))
return;
if (MESA_VERBOSE & (VERBOSE_API | VERBOSE_TEXTURE)) {
_mesa_debug(ctx, "glGetTexImage(tex %u) format = %s, w=%d, h=%d,"
" dstFmt=0x%x, dstType=0x%x\n",
@@ -846,6 +849,9 @@ _mesa_GetnCompressedTexImageARB(GLenum target, GLint level, GLsizei bufSize,
texObj = _mesa_get_current_tex_object(ctx, target);
texImage = _mesa_select_tex_image(ctx, texObj, target, level);
if (_mesa_is_zero_size_texture(texImage))
return;
if (MESA_VERBOSE & (VERBOSE_API | VERBOSE_TEXTURE)) {
_mesa_debug(ctx,
"glGetCompressedTexImage(tex %u) format = %s, w=%d, h=%d\n",

View File

@@ -2816,29 +2816,43 @@ copyteximage(struct gl_context *ctx, GLuint dims,
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexImage%uD", dims);
}
else {
gl_format texFormat;
if (texImage->Data) {
ctx->Driver.FreeTexImageData( ctx, texImage );
}
ASSERT(texImage->Data == NULL);
texFormat = _mesa_choose_texture_format(ctx, texObj, target, level,
internalFormat, GL_NONE,
GL_NONE);
/* choose actual hw format */
gl_format texFormat = _mesa_choose_texture_format(ctx, texObj,
target, level,
internalFormat,
GL_NONE, GL_NONE);
if (legal_texture_size(ctx, texFormat, width, height, 1)) {
GLint srcX = x, srcY = y, dstX = 0, dstY = 0;
/* Free old texture image */
ctx->Driver.FreeTexImageData(ctx, texImage);
_mesa_init_teximage_fields(ctx, target, texImage, width, height, 1,
border, internalFormat, texFormat);
ASSERT(ctx->Driver.CopyTexImage2D);
if (dims == 1)
ctx->Driver.CopyTexImage1D(ctx, target, level, internalFormat,
x, y, width, border);
else
ctx->Driver.CopyTexImage2D(ctx, target, level, internalFormat,
x, y, width, height, border);
/* Allocate texture memory (no pixel data yet) */
if (dims == 1) {
ctx->Driver.TexImage1D(ctx, target, level, internalFormat,
width, border, GL_NONE, GL_NONE, NULL,
&ctx->Unpack, texObj, texImage);
}
else {
ctx->Driver.TexImage2D(ctx, target, level, internalFormat,
width, height, border, GL_NONE, GL_NONE,
NULL, &ctx->Unpack, texObj, texImage);
}
if (_mesa_clip_copytexsubimage(ctx, &dstX, &dstY, &srcX, &srcY,
&width, &height)) {
if (dims == 1)
ctx->Driver.CopyTexSubImage1D(ctx, target, level, dstX,
srcX, srcY, width);
else
ctx->Driver.CopyTexSubImage2D(ctx, target, level, dstX, dstY,
srcX, srcY, width, height);
}
check_gen_mipmap(ctx, target, texObj, level);
@@ -2849,6 +2863,7 @@ copyteximage(struct gl_context *ctx, GLuint dims,
ctx->NewState |= _NEW_TEXTURE;
}
else {
/* probably too large of image */
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexImage%uD", dims);
}
}

View File

@@ -42,6 +42,14 @@ _mesa_alloc_texmemory(GLsizei bytes);
extern void
_mesa_free_texmemory(void *m);
/** Is any of the dimensions of given texture equal to zero? */
static inline GLboolean
_mesa_is_zero_size_texture(const struct gl_texture_image *texImage)
{
return (texImage->Width == 0 ||
texImage->Height == 0 ||
texImage->Depth == 0);
}
/** \name Internal functions */
/*@{*/

View File

@@ -34,8 +34,8 @@ struct gl_context;
/* Mesa version */
#define MESA_MAJOR 7
#define MESA_MINOR 11
#define MESA_PATCH 1
#define MESA_VERSION_STRING "7.11.1"
#define MESA_PATCH 2
#define MESA_VERSION_STRING "7.11.2"
/* To make version comparison easy */
#define MESA_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))