mesa.git
10 years agoi965: Switch fs_live_variables to the non-zeroing allocator.
Francisco Jerez [Fri, 20 Sep 2013 23:36:37 +0000 (16:36 -0700)]
i965: Switch fs_live_variables to the non-zeroing allocator.

All member variables of fs_live_variables are already being
initialized from its constructor, it's not necessary to use rzalloc to
allocate its memory, and doing so makes it more likely that we will
start relying on the allocator to zero out all memory if the class is
ever extended with new member variables.

That's bad because it ties objects to some specific allocation scheme,
and gives unpredictable results when an object is created with a
different allocator -- Stack allocation, array allocation, or
aggregation inside a different object are some of the useful
possibilities that come to my mind.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoi965: Switch fs_inst to the non-zeroing allocator.
Francisco Jerez [Fri, 20 Sep 2013 23:33:55 +0000 (16:33 -0700)]
i965: Switch fs_inst to the non-zeroing allocator.

All member variables of fs_inst are already being initialized from its
constructor, it's not necessary to use rzalloc to allocate its memory,
and doing so makes it more likely that we will start relying on the
allocator to zero out all memory if the class is ever extended with
new member variables.

That's bad because it ties objects to some specific allocation scheme,
and gives unpredictable results when an object is created with a
different allocator -- Stack allocation, array allocation, or
aggregation inside a different object are some of the useful
possibilities that come to my mind.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoi965: Switch ip_record to the non-zeroing allocator.
Francisco Jerez [Fri, 20 Sep 2013 23:31:16 +0000 (16:31 -0700)]
i965: Switch ip_record to the non-zeroing allocator.

All member variables of ip_record are already being initialized from
its constructor, it's not necessary to use rzalloc to allocate its
memory, and doing so makes it more likely that we will start relying
on the allocator to zero out all memory if the class is ever extended
with new member variables.

That's bad because it ties objects to some specific allocation scheme,
and gives unpredictable results when an object is created with a
different allocator -- Stack allocation, array allocation, or
aggregation inside a different object are some of the useful
possibilities that come to my mind.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoi965: Initialize all member variables of cfg_t on construction.
Francisco Jerez [Fri, 20 Sep 2013 23:29:48 +0000 (16:29 -0700)]
i965: Initialize all member variables of cfg_t on construction.

The cfg_t object relies on the memory allocator zeroing out its
contents before it's initialized, which is quite an unusual practice
in the C++ world because it ties objects to some specific allocation
scheme, and gives unpredictable results when an object is created with
a different allocator -- Stack allocation, array allocation, or
aggregation inside a different object are some of the useful
possibilities that come to my mind.  Initialize all fields from the
constructor and stop using the zeroing allocator.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoi965: Initialize all member variables of bblock_t on construction.
Francisco Jerez [Fri, 20 Sep 2013 23:27:42 +0000 (16:27 -0700)]
i965: Initialize all member variables of bblock_t on construction.

The bblock_t object relies on the memory allocator zeroing out its
contents before it's initialized, which is quite an unusual practice
in the C++ world because it ties objects to some specific allocation
scheme, and gives unpredictable results when an object is created with
a different allocator -- Stack allocation, array allocation, or
aggregation inside a different object are some of the useful
possibilities that come to my mind.  Initialize all fields from the
constructor and stop using the zeroing allocator.

v2: Use zero initialization for numeric types instead of default construction.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoglsl: Switch ast_type_qualifier to the non-zeroing allocator.
Francisco Jerez [Fri, 20 Sep 2013 23:23:30 +0000 (16:23 -0700)]
glsl: Switch ast_type_qualifier to the non-zeroing allocator.

All member variables of ast_type_qualifier are already being
initialized from its implicitly defined constructor, it's not
necessary to use rzalloc to allocate its memory.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoglsl: Switch ast_node to the non-zeroing allocator.
Francisco Jerez [Fri, 20 Sep 2013 22:36:38 +0000 (15:36 -0700)]
glsl: Switch ast_node to the non-zeroing allocator.

All member variables of ast_node are already being initialized from
its constructor, but some of its derived classes were leaving members
uninitialized -- Fix them.

Using rzalloc makes it more likely that we will start relying on the
allocator to zero out all memory if the class is ever extended with
new member variables.  That's bad because it ties objects to some
specific allocation scheme, and gives unpredictable results when an
object is created with a different allocator -- Stack allocation,
array allocation, or aggregation inside a different object are some of
the useful possibilities that come to my mind.

v2: Use NULL initialization instead of default construction for pointers.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoi965: Initialize all member variables of vec4_instruction on construction.
Francisco Jerez [Wed, 11 Sep 2013 23:20:18 +0000 (16:20 -0700)]
i965: Initialize all member variables of vec4_instruction on construction.

The vec4_instruction object relies on the memory allocator zeroing out
its contents before it's initialized, which is quite an unusual
practice in the C++ world because it ties objects to some specific
allocation scheme, and gives unpredictable results when an object is
created with a different allocator -- Stack allocation, array
allocation, or aggregation inside a different object are some of the
useful possibilities that come to my mind.  Initialize all fields from
the constructor and stop using the zeroing allocator.

Reviewed-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoglsl: Initialize all member variables of _mesa_glsl_parse_state on construction.
Francisco Jerez [Thu, 12 Sep 2013 03:07:53 +0000 (20:07 -0700)]
glsl: Initialize all member variables of _mesa_glsl_parse_state on construction.

The _mesa_glsl_parse_state object relies on the memory allocator
zeroing out its contents before it's initialized, which is quite an
unusual practice in the C++ world because it ties objects to some
specific allocation scheme, and gives unpredictable results when an
object is created with a different allocator -- Stack allocation,
array allocation, or aggregation inside a different object are some of
the useful possibilities that come to my mind.  Initialize all fields
from the constructor and stop using the zeroing allocator.

Reviewed-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agomesa: Fix misplaced includes of "main/uniforms.h".
Francisco Jerez [Wed, 11 Sep 2013 17:59:13 +0000 (10:59 -0700)]
mesa: Fix misplaced includes of "main/uniforms.h".

Several C++ source files include "main/uniforms.h" from an extern "C"
block, which is both unnecessary, because "uniforms.h" already checks
for a C++ compiler and sets the right linkage, and incorrect, because
the header file includes other C++ headers ("glsl_types.h" and
"ir_uniform.h") that are supposed to get C++ linkage.

Reviewed-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
10 years agost/egl: flush resources before presentation
Grigori Goronzy [Tue, 1 Oct 2013 18:02:10 +0000 (20:02 +0200)]
st/egl: flush resources before presentation

Fixes regression on r600g due to fast clear introduced by commit
edbbfac6.

Signed-off-by: Marek Olšák <marek.olsak@amd.com>
10 years agoi965/gs: Fix incorrect numbering of DWORDs in 3DSTATE_GS
Paul Berry [Sat, 28 Sep 2013 04:29:01 +0000 (21:29 -0700)]
i965/gs: Fix incorrect numbering of DWORDs in 3DSTATE_GS

In commit 247f90c77e8f3894e963d796628246ba0bde27b5 (i965/gs: Set
control data header size/format appropriately for EndPrimitive()), I
incorrectly numbered the DWORDs in the 3DSTATE_GS command starting
from 1 instead of starting from 0.  This caused the control data
format to be programmed into the wrong DWORD, resulting in corruption
in some geometry shaders that used an output type of points.

This patch numbers the DWORDs starting from 0, as we do for all other
commands, which causes the control data format to be programmed into
the correct DWORD.

Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
10 years agomesa: check for bufSize > 0 in _mesa_GetSynciv()
Brian Paul [Sat, 14 Sep 2013 16:09:24 +0000 (10:09 -0600)]
mesa: check for bufSize > 0 in _mesa_GetSynciv()

The spec doesn't say GL_INVALID_VALUE should be raised for bufSize <= 0.
In any case, memcpy(len < 0) will lead to a crash, so don't allow it.

CC: "9.2" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agomesa: minor fix-ups for _mesa_validate_sync()
Brian Paul [Sat, 14 Sep 2013 16:04:51 +0000 (10:04 -0600)]
mesa: minor fix-ups for _mesa_validate_sync()

Return bool instead of int.  Const-qualify the syncObj.  Add some comments.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agomesa: add missing error checks in _mesa_GetObject[Ptr]Label()
Brian Paul [Sat, 14 Sep 2013 15:59:18 +0000 (09:59 -0600)]
mesa: add missing error checks in _mesa_GetObject[Ptr]Label()

Error checking bufSize isn't mentioned in the spec, but it is in the
man pages.  However, I believe the man page is incorrect.  Typically,
GL functions that take GLsizei parameters check that they're positive
or non-negative.  Negative values don't make sense here.

A spec bug has been filed with Khronos/ARB.

v2: check for negative values, not <= 0.

10 years agomesa: use caller string in error message in get_label_pointer()
Brian Paul [Sat, 14 Sep 2013 15:56:08 +0000 (09:56 -0600)]
mesa: use caller string in error message in get_label_pointer()

Reviewed-by: Timothy Arceri <t_arceri@yahoo.com.au>
10 years agomesa: asst. clean-ups in copy_label()
Brian Paul [Sat, 14 Sep 2013 15:52:58 +0000 (09:52 -0600)]
mesa: asst. clean-ups in copy_label()

This incorporates Vinson's change to check for a null src pointer as
detected by coverity.

Also, rename the function params to be src/dst, const-qualify src,
and use GL types to match the calling functions.  And add some more
comments.

Reviewed-by: Timothy Arceri <t_arceri@yahoo.com.au>
10 years agost/xorg: Include u_surface.h for u_copy_rect
Alex Deucher [Tue, 1 Oct 2013 15:15:26 +0000 (11:15 -0400)]
st/xorg: Include u_surface.h for u_copy_rect

Fixes build errors.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agowinsys/freedreno/drm: drop obsolete .gitignore
Emil Velikov [Sun, 22 Sep 2013 15:30:31 +0000 (16:30 +0100)]
winsys/freedreno/drm: drop obsolete .gitignore

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
10 years agowinsys/freedreno/drm: consolidate C sources list into Makefile.sources
Emil Velikov [Sun, 22 Sep 2013 15:29:48 +0000 (16:29 +0100)]
winsys/freedreno/drm: consolidate C sources list into Makefile.sources

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
10 years agowinsys/nouveau/drm: consolidate C sources list into Makefile.sources
Emil Velikov [Sun, 22 Sep 2013 15:33:52 +0000 (16:33 +0100)]
winsys/nouveau/drm: consolidate C sources list into Makefile.sources

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
10 years agowinsys/i915/sw: consolidate C sources list into Makefile.sources
Emil Velikov [Sun, 22 Sep 2013 15:25:28 +0000 (16:25 +0100)]
winsys/i915/sw: consolidate C sources list into Makefile.sources

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
10 years agost/xvmc: consolidate C sources list into Makefile.sources
Emil Velikov [Sun, 22 Sep 2013 19:52:11 +0000 (20:52 +0100)]
st/xvmc: consolidate C sources list into Makefile.sources

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
10 years agost/xorg: consolidate C sources list into Makefile.sources
Emil Velikov [Wed, 5 Jun 2013 23:16:38 +0000 (00:16 +0100)]
st/xorg: consolidate C sources list into Makefile.sources

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
10 years agost/xa: consolidate C sources list into Makefile.sources
Emil Velikov [Sun, 22 Sep 2013 19:49:43 +0000 (20:49 +0100)]
st/xa: consolidate C sources list into Makefile.sources

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
10 years agost/wgl: consolidate C sources list into Makefile.sources
Emil Velikov [Sun, 22 Sep 2013 19:45:09 +0000 (20:45 +0100)]
st/wgl: consolidate C sources list into Makefile.sources

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
10 years agost/vega: consolidate C sources list into Makefile.sources
Emil Velikov [Wed, 5 Jun 2013 23:24:06 +0000 (00:24 +0100)]
st/vega: consolidate C sources list into Makefile.sources

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
10 years agost/vdpau: consolidate C sources list into Makefile.sources
Emil Velikov [Sun, 22 Sep 2013 19:36:42 +0000 (20:36 +0100)]
st/vdpau: consolidate C sources list into Makefile.sources

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
10 years agost/osmesa: consolidate C sources list into Makefile.sources
Emil Velikov [Sun, 22 Sep 2013 19:35:21 +0000 (20:35 +0100)]
st/osmesa: consolidate C sources list into Makefile.sources

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
10 years agost/glx: consolidate C sources list into Makefile.sources
Emil Velikov [Sun, 22 Sep 2013 15:14:06 +0000 (16:14 +0100)]
st/glx: consolidate C sources list into Makefile.sources

Move glx/{,xlib/}Makefile.am to preserve file list

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
10 years agost/gbm: consolidate C sources list into Makefile.sources
Emil Velikov [Sun, 22 Sep 2013 19:33:45 +0000 (20:33 +0100)]
st/gbm: consolidate C sources list into Makefile.sources

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
10 years agost/egl: consolidate C sources lists into Makefile.sources
Emil Velikov [Sun, 22 Sep 2013 16:22:15 +0000 (17:22 +0100)]
st/egl: consolidate C sources lists into Makefile.sources

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
10 years agost/dri/sw: consolidate C sources list into Makefile.sources
Emil Velikov [Wed, 5 Jun 2013 23:02:35 +0000 (00:02 +0100)]
st/dri/sw: consolidate C sources list into Makefile.sources

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
10 years agost/dri: consolidate C sources list into Makefile.sources
Emil Velikov [Wed, 5 Jun 2013 22:57:23 +0000 (23:57 +0100)]
st/dri: consolidate C sources list into Makefile.sources

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
10 years agost/clover: consolidate CPP sources list into Makefile.sources
Emil Velikov [Sun, 22 Sep 2013 19:30:25 +0000 (20:30 +0100)]
st/clover: consolidate CPP sources list into Makefile.sources

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
10 years agogalahad: consolidate C sources list into Makefile.sources
Emil Velikov [Wed, 5 Jun 2013 22:42:16 +0000 (23:42 +0100)]
galahad: consolidate C sources list into Makefile.sources

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
10 years agonoop: consolidate C sources list into Makefile.sources
Emil Velikov [Wed, 5 Jun 2013 22:33:38 +0000 (23:33 +0100)]
noop: consolidate C sources list into Makefile.sources

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
10 years agoidentity: consolidate C sources list into Makefile.sources
Emil Velikov [Wed, 5 Jun 2013 22:28:11 +0000 (23:28 +0100)]
identity: consolidate C sources list into Makefile.sources

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
10 years agofreedreno: consolidate C sources list into Makefile.sources
Emil Velikov [Wed, 8 May 2013 22:46:38 +0000 (23:46 +0100)]
freedreno: consolidate C sources list into Makefile.sources

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
10 years agotrace: consolidate C sources list into Makefile.sources
Emil Velikov [Wed, 8 May 2013 22:44:15 +0000 (23:44 +0100)]
trace: consolidate C sources list into Makefile.sources

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
10 years agollvmpipe: consolidate C sources list into Makefile.sources
Emil Velikov [Wed, 8 May 2013 22:42:23 +0000 (23:42 +0100)]
llvmpipe: consolidate C sources list into Makefile.sources

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
10 years agorbug: consolidate C sources list into Makefile.sources
Emil Velikov [Wed, 8 May 2013 22:34:36 +0000 (23:34 +0100)]
rbug: consolidate C sources list into Makefile.sources

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
10 years agosoftpipe: consolidate C sources list into Makefile.sources
Emil Velikov [Wed, 8 May 2013 22:28:04 +0000 (23:28 +0100)]
softpipe: consolidate C sources list into Makefile.sources

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
10 years agor600: use NEED_RADEON_LLVM over R600_NEED_RADEON_GALLIUM
Emil Velikov [Tue, 17 Sep 2013 17:29:19 +0000 (18:29 +0100)]
r600: use NEED_RADEON_LLVM over R600_NEED_RADEON_GALLIUM

libllvmradeon.la is available whenever NEED_RADEON_LLVM is set, using
R600_NEED_RADEON_GALLIUM is rather ambiguous and unnecessary. Drop it
in favour of NEED_RADEON_LLVM.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
10 years agogallium/radeon: drop unused variable LIBGALLIUM_LIBS
Emil Velikov [Tue, 17 Sep 2013 17:46:24 +0000 (18:46 +0100)]
gallium/radeon: drop unused variable LIBGALLIUM_LIBS

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
10 years agomesa/drivers: drop HAVE_*_DRI from individual makefiles
Emil Velikov [Tue, 17 Sep 2013 14:58:29 +0000 (15:58 +0100)]
mesa/drivers: drop HAVE_*_DRI from individual makefiles

The mesa/drivers/dri/Makefile.am already guards the individual
targets/subdirs with HAVE_*_DRI before including them. Thus making
the additional check within each Makefile.am unnecessary.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agogallium/targets: Make use of prebuilt libdricommon.la.
Johannes Obermayr [Tue, 17 Sep 2013 17:09:02 +0000 (18:09 +0100)]
gallium/targets: Make use of prebuilt libdricommon.la.

libdricommon.la is available whenever a non swrast driver is built.
All the classic dri drivers make use of the prebuild library but all
of the gallium ones rebuild it explicitly.

While we're here gallium/{llvm,soft}pipe does not require HAVE_COMMON_DRI
thus do not set in during configure.

v2: [Emil] Add commit message and drop HAVE_COMMON_DRI from configure.ac
v3: [Emil] Rebase and resolve targets/r*/dri conflicts

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
10 years agoi915: Fix memory leak in do_blit_readpixels.
Vinson Lee [Sat, 28 Sep 2013 05:11:17 +0000 (22:11 -0700)]
i915: Fix memory leak in do_blit_readpixels.

Fixes "Resource leak" defect reported by Coverity.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agollvmpipe: Remove unnecessary null check of shader.
Vinson Lee [Sat, 28 Sep 2013 04:27:19 +0000 (21:27 -0700)]
llvmpipe: Remove unnecessary null check of shader.

shader has already been dereferenced earlier so cannot be null here.

Fixes "Dereference before null check" defect reported by Coverity.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agoutil/u_format: Assert that format block size is at least 1 byte.
Vinson Lee [Sat, 28 Sep 2013 05:42:58 +0000 (22:42 -0700)]
util/u_format: Assert that format block size is at least 1 byte.

The block size for all formats is currently at least 1 byte. Add an
assertion for this.

This should silence several Coverity "Division or modulo by zero"
defects.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agodraw: Add a null check for draw.
Vinson Lee [Sat, 28 Sep 2013 04:46:33 +0000 (21:46 -0700)]
draw: Add a null check for draw.

There is an earlier null check for draw so draw could be null here as
well.

Fixes "Dereference after null check" defect reported by Coverity.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agost/vdpau: Include u_surface.h for u_copy_rect.
Vinson Lee [Tue, 1 Oct 2013 03:48:14 +0000 (20:48 -0700)]
st/vdpau: Include u_surface.h for u_copy_rect.

Fix build errors.

  CC     surface.lo
surface.c: In function 'vlVdpVideoSurfaceGetBitsYCbCr':
surface.c:247:10: error: implicit declaration of function 'util_copy_rect' [-Werror=implicit-function-declaration]

  CC     output.lo
output.c: In function 'vlVdpOutputSurfaceGetBitsNative':
output.c:216:4: error: implicit declaration of function 'util_copy_rect' [-Werror=implicit-function-declaration]

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
10 years agost/vdpau: Include u_format.h for util_format_description.
Vinson Lee [Tue, 1 Oct 2013 03:36:14 +0000 (20:36 -0700)]
st/vdpau: Include u_format.h for util_format_description.

Fix build error.

  CC     device.lo
device.c: In function 'vlVdpDefaultSamplerViewTemplate':
device.c:251:4: error: implicit declaration of function 'util_format_description' [-Werror=implicit-function-declaration]
device.c:251:9: warning: assignment makes pointer from integer without a cast [enabled by default]
device.c:252:12: error: dereferencing pointer to incomplete type
device.c:252:28: error: 'UTIL_FORMAT_SWIZZLE_0' undeclared (first use in this function)
device.c:252:28: note: each undeclared identifier is reported only once for each function it appears in
device.c:254:12: error: dereferencing pointer to incomplete type
device.c:256:12: error: dereferencing pointer to incomplete type
device.c:258:12: error: dereferencing pointer to incomplete type

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
10 years agost/xvmc: Include u_surface.h for u_copy_rect.
Vinson Lee [Tue, 1 Oct 2013 03:11:24 +0000 (20:11 -0700)]
st/xvmc: Include u_surface.h for u_copy_rect.

This patch fixes the build error introduced with commit
81bb98e928861260170c16f5c3e0d80492251d6b.

  CC     subpicture.lo
subpicture.c: In function 'upload_sampler':
subpicture.c:181:4: error: implicit declaration of function 'util_copy_rect' [-Werror=implicit-function-declaration]
subpicture.c: In function 'XvMCClearSubpicture':
subpicture.c:304:21: error: storage size of 'uc' isn't known
subpicture.c:328:4: error: implicit declaration of function 'util_fill_rect' [-Werror=implicit-function-declaration]
subpicture.c:304:21: warning: unused variable 'uc' [-Wunused-variable]

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
10 years agost/egl: include u_format.h for util_format_get_blocksize()
Brian Paul [Tue, 1 Oct 2013 01:02:27 +0000 (19:02 -0600)]
st/egl: include u_format.h for util_format_get_blocksize()

10 years agosvga: fix pixel center integer
Brian Paul [Mon, 30 Sep 2013 15:47:31 +0000 (09:47 -0600)]
svga: fix pixel center integer

The svga/d3d9 convention is that pixel centers are at integer coordinates.
Fixes piglit glsl-arb-fragment-coord-conventions test.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
10 years agosvga: return 0 for PIPE_CAP_PREFER_BLIT_BASED_TEXTURE_TRANSFER
Brian Paul [Mon, 30 Sep 2013 15:47:31 +0000 (09:47 -0600)]
svga: return 0 for PIPE_CAP_PREFER_BLIT_BASED_TEXTURE_TRANSFER

Using the map/unmap path for glTexImage is a little bit faster
than blitting.  Also, this fixes about 50 assorted piglit failures
that seem to be related to the blit version of glReadPixels.

Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: José Fonseca <jfonseca@vmware.com>
10 years agosvga: we don't support TGSI_OPCODE_CONT
Brian Paul [Mon, 30 Sep 2013 15:47:31 +0000 (09:47 -0600)]
svga: we don't support TGSI_OPCODE_CONT

So return PIPE_SHADER_CAP_TGSI_CONT_SUPPORTED = 0.

10 years agogallium: include u_surface.h instead of u_rect.h
Brian Paul [Mon, 30 Sep 2013 15:07:33 +0000 (09:07 -0600)]
gallium: include u_surface.h instead of u_rect.h

u_rect.h was including u_surface.h just to avoid touching a bunch
of other source files after some functions were moved from u_rect.h
to u_surface.h.  This patch cleans up that hack.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
10 years agoi965: Reenable glBitmap() after the sRGB winsys enabling.
Eric Anholt [Thu, 19 Sep 2013 15:45:07 +0000 (08:45 -0700)]
i965: Reenable glBitmap() after the sRGB winsys enabling.

The format of the window system framebuffer changed from ARGB8888 to
SARGB8, but we're still supposed to render to it the same as ARGB8888
unless the user flipped the GL_FRAMEBUFFER_SRGB switch.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
NOTE: This is a candidate for stable branches.

10 years agomesa: Remove all traces of GL_OES_matrix_get
Ian Romanick [Fri, 13 Sep 2013 16:31:00 +0000 (11:31 -0500)]
mesa: Remove all traces of GL_OES_matrix_get

I believe this extension was enabled by accident.  As far as I can tell,
there has never been any code in Mesa to actually support it.  Not only
that, this extension is only useful in the common-lite profile, and Mesa
does the common profile.

This "fixes" the piglit test oes_matrix_get-api.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Cc: "9.1 9.2" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoUse -Bsymbolic when linking libEGL.so
Carl Worth [Fri, 27 Sep 2013 21:01:48 +0000 (14:01 -0700)]
Use -Bsymbolic when linking libEGL.so

For some reason that I don't yet fully understand, Glaze does not work with
libEGL unless libEGL is linked with -Bsymbolic.[*]

Beyond that specific reason, all of the reasons for which libGL.so is linked
with -Bsymbolic, (see the commit history), should also apply here.

[*] The specific behavior I am seeing is that when Glaze calls dlopen for
libEGL.so, ifunc resolvers within Glaze for EGL functions are called before
the dlopen returns. These resolvers cannot succeed, as they need the return
value from dlopen in order to find the functions to resolve to. I don't know
what's causing these resolvers to be called, but I have verified that linking
libEGL with -Bsymbolic causes this problematic behavior to stop.

CC: "9.1 and 9.2" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoi965/blorp: retype destination register for texture SEND instruction to UW.
Paul Berry [Tue, 24 Sep 2013 22:18:52 +0000 (15:18 -0700)]
i965/blorp: retype destination register for texture SEND instruction to UW.

From the bspec documentation of the SEND instruction:

    "destination region cannot cross the 256-bit register boundary."

To avoid violating this restriction when executing SIMD16 texturing
operations (such as those used by blorp), we need to ensure that the
destination of the SEND instruction doesn't exceed 256 bits in size.
An easy way to do this is to set the type of the destination register
to UW (unsigned word), since 16 unsigned words can fit inside a
256-bit register.  Fortunately, this has no effect on the sampling
operation, since the sampler always infers the destination data type
from the sampler message rather than from the type of the instruction
operand.

Previously, we did this for texturing operations issued by the vec4
and fs back-ends, but not for blorp.  This patch makes blorp use the
same trick.

I haven't observed any behavioural difference on actual hardware due
to this patch, but it avoids a warning from the simulator so it seems
like the right thing to do.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Acked-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoi965: Add a real native TexStorage path.
Eric Anholt [Fri, 30 Aug 2013 21:39:25 +0000 (14:39 -0700)]
i965: Add a real native TexStorage path.

We originally had a path just did the loop and called
ctx->Driver.AllocTextureImageBuffer(), which I moved into Mesa core.  But
we can do better, avoiding incorrect miptree size guesses and later
texture validations by just directly allocating the miptree and setting it
to all the images.

v2: drop debug printf.

Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoi965: Add missing license to intel_tex_validate.c.
Eric Anholt [Fri, 30 Aug 2013 20:41:44 +0000 (13:41 -0700)]
i965: Add missing license to intel_tex_validate.c.

I've rewritten a lot of this file.

Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoi965: Always allocate validated miptrees from level 0.
Eric Anholt [Fri, 30 Aug 2013 20:03:52 +0000 (13:03 -0700)]
i965: Always allocate validated miptrees from level 0.

No change in copies during a piglit run, but it's one less first_level !=
0 in our codebase.

Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoi965: Don't relayout a texture just for baselevel changes.
Eric Anholt [Fri, 30 Aug 2013 20:03:52 +0000 (13:03 -0700)]
i965: Don't relayout a texture just for baselevel changes.

As long as the baselevel, maxlevel still sit inside the range we had
previously validated, there's no need to reallocate the texture.

I also hope this makes our texture validation logic much more obvious.
It's taken me enough tries to write this change, that's for sure.  Reduces
miptree copy count on a piglit run by 1.3%, though the change in amount of
data moved is much smaller.

Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoi965: Don't allocate a 1-level texture when GL_GENERATE_MIPMAP is set.
Eric Anholt [Fri, 30 Aug 2013 19:47:02 +0000 (12:47 -0700)]
i965: Don't allocate a 1-level texture when GL_GENERATE_MIPMAP is set.

Given that a teximage that calls us with this flag set will immediately
proceed to allocate the other levels, we can probably just go ahead and
allocate those levels now.

Reduces miptree copies in piglit by about .05%.

Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoi965: Stop allocating miptrees with first_level != 0.
Eric Anholt [Fri, 30 Aug 2013 19:37:15 +0000 (12:37 -0700)]
i965: Stop allocating miptrees with first_level != 0.

If the caller shows up with GL_BASE_LEVEL != 0, it doesn't mean that the
texture will over the course of its lifetime have that nonzero baselevel,
it means that the caller is filling the texture from the bottom up for
some reason (one could imagine demand-loading detailed texture layers at
runtime, for example).  If we allocate from just the current baselevel, it
means when they come along with the next level up, we'll have to allocate
a new miptree and copy all of our bits out of the first miptree.

Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoi965: Drop a special case for guessing small miptree levels.
Eric Anholt [Fri, 30 Aug 2013 19:21:38 +0000 (12:21 -0700)]
i965: Drop a special case for guessing small miptree levels.

Let's say you started allocating your 2D texture with level 2 of a tree as
a 1x1 image.  The driver doesn't know if this means that level 0 is 4x4 or
4x1 or 1x4, so we would just allocate a single 1x1 and let it get copied
in to the real location at texture validate time later.

Since this is just a temporary allocation that *will* get copied, the
extra space allocation of just taking the normal path which will happen to
producing a 4x1 level 0, 2x1 level 1, and 1x1 level 2 is the right way to
go, to reduce complexity in the normal case.

No change in miptree copies over the course of a piglit run.

Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoi965: Totally switch around how we handle nonzero baselevel-first_level.
Eric Anholt [Tue, 17 Sep 2013 23:47:30 +0000 (16:47 -0700)]
i965: Totally switch around how we handle nonzero baselevel-first_level.

This has no effect currently, because intel_finalize_mipmap_tree() always
makes mt->first_level == tObj->BaseLevel.

The change I made before to handle it
(b1080cfbdb0a084122fcd662cd27b4748c5598fd) got very close to working, but
after fixing some unrelated bugs in the series, it still left
tex-miplevel-selection producing errors when testing textureLod().  The
problem is that for explicit LODs, the sampler's LOD clamping is ignored,
and only the surface's MIP clamping is respected.  So we need to use
surface mip clamping, which applies on top of the sampler's mip clamping,
so the sampler change gets backed out.

Now actually tested with a non-regressing series producing a non-zero
computed baselevel.

Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoi965: Always look up from the object's mt when setting up texturing state.
Eric Anholt [Tue, 17 Sep 2013 23:16:20 +0000 (16:16 -0700)]
i965: Always look up from the object's mt when setting up texturing state.

We know that the object's mt is equal to the firstimage's mt because it's
gone through intel_finalize_mipmap_tree().  Saves a lookup of firstimage
on pre-gen7.

v2: Merge in the warning fix that appeared later in the series (noted by
    Chad)

Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
10 years agor600g/sb: Move variable dereference after null check.
Vinson Lee [Sat, 28 Sep 2013 06:05:54 +0000 (23:05 -0700)]
r600g/sb: Move variable dereference after null check.

Fixes "Deference before null check" defect reported by Coverity.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Vadim Girlin <vadimgirlin@gmail.com>
10 years agost/mesa: fix comment typo
Brian Paul [Mon, 30 Sep 2013 15:06:52 +0000 (09:06 -0600)]
st/mesa: fix comment typo

10 years agor600g,radeonsi: workaround for late shared screen initialization
Marek Olšák [Mon, 30 Sep 2013 10:57:51 +0000 (12:57 +0200)]
r600g,radeonsi: workaround for late shared screen initialization

Accidentally broken by the consolidation.

10 years agor600g: Fix build failure introduced with r600_texture.c consolidation
Laurent Carlier [Sun, 29 Sep 2013 19:45:09 +0000 (21:45 +0200)]
r600g: Fix build failure introduced with r600_texture.c consolidation

It seems that case with opencl enabled was forgotten

Signed-off-by: Marek Olšák <marek.olsak@amd.com>
10 years agoradeon: make texture logging more useful
Marek Olšák [Tue, 24 Sep 2013 11:56:27 +0000 (13:56 +0200)]
radeon: make texture logging more useful

This has been very useful for tracking down bugs in libdrm.

The *_PRINT_TEXDEPTH environment variables were probably never used,
so I removed them.

10 years agor600g,radeonsi: share r600_texture.c
Marek Olšák [Sun, 22 Sep 2013 11:06:27 +0000 (13:06 +0200)]
r600g,radeonsi: share r600_texture.c

The function r600_choose_tiling is new and needs a review.

The only change in functionality is that it enables 2D tiling for compressed
textures on SI. It was probably accidentally turned off.

v2: don't make scanout buffers linear

10 years agor600g: remove compute_global_transfer_* calls from texture_transfer_map/unmap
Marek Olšák [Wed, 25 Sep 2013 18:57:22 +0000 (20:57 +0200)]
r600g: remove compute_global_transfer_* calls from texture_transfer_map/unmap

Textures can never have target==PIPE_BUFFER.

10 years agor600g: move the low-level buffer functions for multiple rings to drivers/radeon
Marek Olšák [Mon, 23 Sep 2013 00:37:05 +0000 (02:37 +0200)]
r600g: move the low-level buffer functions for multiple rings to drivers/radeon

Also slightly optimize r600_buffer_map_sync_with_rings.

10 years agor600g,radeonsi: consolidate tiling_info initialization
Marek Olšák [Sun, 22 Sep 2013 20:12:18 +0000 (22:12 +0200)]
r600g,radeonsi: consolidate tiling_info initialization

and the util_format_s3tc_init calls too.

10 years agoradeonsi: implement clear_buffer using CP DMA, initialize CMASK with it
Marek Olšák [Sun, 22 Sep 2013 19:47:35 +0000 (21:47 +0200)]
radeonsi: implement clear_buffer using CP DMA, initialize CMASK with it

More work needs to be done for this to be entirely shared with r600g.
I'm just trying to share r600_texture.c now.

The reason I put the implementation to si_descriptors.c is that the emit
function had already been there.

10 years agor600g: move aux_context and r600_screen_clear_buffer to drivers/radeon
Marek Olšák [Sun, 22 Sep 2013 19:45:23 +0000 (21:45 +0200)]
r600g: move aux_context and r600_screen_clear_buffer to drivers/radeon

This will be used in the next commit.

10 years agoradeonsi: move debug options to R600_DEBUG
Marek Olšák [Sun, 22 Sep 2013 13:34:12 +0000 (15:34 +0200)]
radeonsi: move debug options to R600_DEBUG

10 years agor600g: move some debug options to drivers/radeon
Marek Olšák [Sun, 22 Sep 2013 13:18:11 +0000 (15:18 +0200)]
r600g: move some debug options to drivers/radeon

10 years agor600g,radeonsi: share the async dma interface
Marek Olšák [Sun, 22 Sep 2013 00:55:47 +0000 (02:55 +0200)]
r600g,radeonsi: share the async dma interface

r600_texture.c is one step closer to r600g.

10 years agoradeonsi: move radeonsi-specific functions out of r600_texture.c
Marek Olšák [Sat, 21 Sep 2013 21:33:30 +0000 (23:33 +0200)]
radeonsi: move radeonsi-specific functions out of r600_texture.c

10 years agor600g,radeonsi: remove unused code
Marek Olšák [Sat, 21 Sep 2013 21:05:08 +0000 (23:05 +0200)]
r600g,radeonsi: remove unused code

10 years agor600g: move r600g-specific functions out of r600_texture.c
Marek Olšák [Sat, 21 Sep 2013 18:50:33 +0000 (20:50 +0200)]
r600g: move r600g-specific functions out of r600_texture.c

10 years agor600g,radeonsi: consolidate r600_texture structures
Marek Olšák [Sat, 21 Sep 2013 18:14:52 +0000 (20:14 +0200)]
r600g,radeonsi: consolidate r600_texture structures

10 years agor600g: get rid of r600_texture::is_rat
Marek Olšák [Sat, 21 Sep 2013 18:07:18 +0000 (20:07 +0200)]
r600g: get rid of r600_texture::is_rat

It's always 0.

10 years agor600g: get rid of r600_texture::array_mode
Marek Olšák [Sat, 21 Sep 2013 18:02:55 +0000 (20:02 +0200)]
r600g: get rid of r600_texture::array_mode

10 years agor600g,radeonsi: consolidate transfer, cmask, and fmask structures
Marek Olšák [Sat, 21 Sep 2013 17:56:24 +0000 (19:56 +0200)]
r600g,radeonsi: consolidate transfer, cmask, and fmask structures

10 years agoradeon drivers: handle PIPE_CAP_MAX_VIEWPORTS
Marek Olšák [Sat, 21 Sep 2013 17:45:08 +0000 (19:45 +0200)]
radeon drivers: handle PIPE_CAP_MAX_VIEWPORTS

10 years agoradeon/llvm: fix TGSI_OPCODE_UCMP
Marek Olšák [Wed, 25 Sep 2013 18:07:16 +0000 (20:07 +0200)]
radeon/llvm: fix TGSI_OPCODE_UCMP

This doesn't fix any known issue (I haven't run piglit with this yet),
but the code was obviously completely wrong. It looks like copy-pasted from CMP.

Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
10 years agost/mesa: fix GLSL mix(.., .., bvecN)
Marek Olšák [Mon, 23 Sep 2013 20:43:23 +0000 (22:43 +0200)]
st/mesa: fix GLSL mix(.., .., bvecN)

v2: use CMP on drivers without native integer support

10 years agoconfigure.ac: Add a more informative warning when libclc.pc is not found v2
Tom Stellard [Thu, 5 Sep 2013 23:26:17 +0000 (16:26 -0700)]
configure.ac: Add a more informative warning when libclc.pc is not found v2

v2:
  - Don't display an error message when the user doesn't ask for libclc.

Reviewed-by: Matt Turner <mattst88@gmail.com>
10 years agomesa: Include stdint.h in mtypes.h for uint32_t symbol.
Vinson Lee [Fri, 27 Sep 2013 03:40:39 +0000 (20:40 -0700)]
mesa: Include stdint.h in mtypes.h for uint32_t symbol.

This patch fixes the MSVC build error introduced with commit
b2e327e08f8519da131dd382adcc99240d433404.

api_arrayelt.c
src\mesa\main/mtypes.h(1809) : error C2061: syntax error : identifier 'uint32_t'
src\mesa\main/mtypes.h(1810) : error C2059: syntax error : '}'
src\mesa\main/mtypes.h(1825) : error C2079: 'Minimum' uses undefined union 'gl_perf_monitor_counter_value'
src\mesa\main/mtypes.h(1828) : error C2079: 'Maximum' uses undefined union 'gl_perf_monitor_counter_value'

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
10 years agoi965/fs: Don't double-accept operands of logical and/or/xor operations.
Kenneth Graunke [Mon, 23 Sep 2013 20:37:00 +0000 (13:37 -0700)]
i965/fs: Don't double-accept operands of logical and/or/xor operations.

If the argument to emit_bool_to_cond_code() is an ir_expression, we
loop over the operands, calling accept() on each of them, which
generates assembly code to compute that subexpression.  We then emit
one or two final instruction that perform the top-level operation on
those operands.

If it's not an expression (say, a boolean-valued variable), we simply
call accept() on the whole value.

In commit 80ecb8f1 (i965/fs: Avoid generating extra AND instructions on
bool logic ops), Eric made logic operations jump out of the expression
path to the non-expression path.

Unfortunately, this meant that we would first accept() the two operands,
skip generating any code that used them, then accept() the whole
expression, generating code for the operands a second time.

Dead code elimination would always remove the first set of redundant
operand assembly, since nothing actually used them.  But we shouldn't
generate it in the first place.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
10 years agoi965: Add #define for MI_REPORT_PERF_COUNT on Gen6+.
Kenneth Graunke [Tue, 26 Mar 2013 22:22:22 +0000 (15:22 -0700)]
i965: Add #define for MI_REPORT_PERF_COUNT on Gen6+.

This appears in Volume 1 Part 1 of the Sandybridge PRM on page 48.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>