mesa.git
13 years agoglsl: Implement the GL_ARB_conservative_depth extension.
Kenneth Graunke [Tue, 9 Aug 2011 17:53:29 +0000 (10:53 -0700)]
glsl: Implement the GL_ARB_conservative_depth extension.

It's the same as GL_AMD_conservative_depth.  The specs have slight
differences in wording, but don't differ in content or behavior.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agoDocument the return type coding style.
Kai Wasserbäch [Tue, 23 Aug 2011 08:48:58 +0000 (10:48 +0200)]
Document the return type coding style.

As per discussion at [0] methods shouldn't use OpenGL return types, if
they're not part of the GL API.

[0] <http://marc.info/?l=mesa3d-dev&m=130754488901774&w=2>

Signed-off-by: Kai Wasserbäch <kai@dev.carbon-project.org>
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
13 years agoChange return type of try_emit_* methods to bool.
Kai Wasserbäch [Tue, 23 Aug 2011 08:48:57 +0000 (10:48 +0200)]
Change return type of try_emit_* methods to bool.

Ian Romanick explained (Message-Id: <4E528973.6080902@freedesktop.org>),
that the return type of non-API methods shouldn't use GLboolean but a
standard C++ bool.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Bryan Cain <bryancain3@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Kai Wasserbäch <kai@dev.carbon-project.org>
13 years agod3d1x: save to correct slot in xs_set_constant_buffers
Christoph Bumiller [Thu, 25 Aug 2011 10:52:35 +0000 (12:52 +0200)]
d3d1x: save to correct slot in xs_set_constant_buffers

13 years agod3d1x: fix xs_set_samplers
Christoph Bumiller [Sat, 28 May 2011 09:56:43 +0000 (11:56 +0200)]
d3d1x: fix xs_set_samplers

13 years agoandroid: add support for r600g
Chia-I Wu [Fri, 19 Aug 2011 06:35:45 +0000 (14:35 +0800)]
android: add support for r600g

Tested with a Radeon HD 6250.  SurfaceFlinger (the display server and
compositor) works.  2D apps with RGB or RGBA visuals work.  As for 3D
apps, some work but some don't (with serious rendering defects).

Reviewed-by: Marek Olšák <maraeo@gmail.com>
13 years agowinsys/radeon: share the source list
Chia-I Wu [Fri, 19 Aug 2011 07:00:20 +0000 (15:00 +0800)]
winsys/radeon: share the source list

Factor out C_SOURCES from Makefile to Makefile.sources, and let
Makefile and SConscript share it.

Reviewed-by: Marek Olšák <maraeo@gmail.com>
13 years agowinsys/r600: share the source list
Chia-I Wu [Fri, 19 Aug 2011 06:58:57 +0000 (14:58 +0800)]
winsys/r600: share the source list

Factor out C_SOURCES from Makefile to Makefile.sources, and let
Makefile and SConscript share it.

Reviewed-by: Marek Olšák <maraeo@gmail.com>
13 years agor600g: share the source list
Chia-I Wu [Fri, 19 Aug 2011 06:41:29 +0000 (14:41 +0800)]
r600g: share the source list

Factor out C_SOURCES from Makefile to Makefile.sources, and let
Makefile and SConscript share it.

Reviewed-by: Marek Olšák <maraeo@gmail.com>
13 years agoglsl: Make sure that Extensions.dummy_true is set to true
Ian Romanick [Wed, 24 Aug 2011 20:01:18 +0000 (13:01 -0700)]
glsl: Make sure that Extensions.dummy_true is set to true

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
13 years agovbo: remove unused var, remove unneeded local var
Brian Paul [Wed, 24 Aug 2011 20:50:28 +0000 (14:50 -0600)]
vbo: remove unused var, remove unneeded local var

13 years agollvmpipe: add more restrict keywords
Brian Paul [Wed, 24 Aug 2011 20:08:03 +0000 (14:08 -0600)]
llvmpipe: add more restrict keywords

Put restrict in the function definitions to silence MSVC warnings
about incompatible assignments in "func = lp_tile_foobar;" when func
was declared with restrict keywords but the rhs function wasn't.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
13 years agodocs: Document coding style conventions
Paul Berry [Tue, 16 Aug 2011 21:09:32 +0000 (14:09 -0700)]
docs: Document coding style conventions

This patch documents some Mesa coding style conventions that came up
during the discussion of commit 67b5a32 (Perform implicit type
conversions on function call out parameters).

13 years agoswrast: Remove swrast eject/validate texture image code.
Brian Paul [Fri, 29 Jul 2011 22:19:43 +0000 (15:19 -0700)]
swrast: Remove swrast eject/validate texture image code.

No driver used the eject function, or set the validate hook that made
that function do anything.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
13 years agoradeon: Fix flushing before writing a teximage's BO when !t->bo.
Eric Anholt [Thu, 4 Aug 2011 01:29:36 +0000 (18:29 -0700)]
radeon: Fix flushing before writing a teximage's BO when !t->bo.

Before, if we ended up here without a BO for our image, but did choose
a miptree that had active rendering in the command buffer, our
teximage data would jump ahead of the rendering using the old texture
contents.

This showed up as breakage in gen-teximage and friends in the
following commit.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
13 years agost/mesa: remove st_texture_image::face,level fields
Brian Paul [Fri, 15 Jul 2011 02:57:34 +0000 (20:57 -0600)]
st/mesa: remove st_texture_image::face,level fields

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
13 years agointel: use new gl_texture_image:Face, Level fields
Brian Paul [Fri, 15 Jul 2011 02:57:34 +0000 (20:57 -0600)]
intel: use new gl_texture_image:Face, Level fields

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
13 years agomesa: add gl_texture_image::Face, Level fields
Brian Paul [Fri, 15 Jul 2011 02:57:34 +0000 (20:57 -0600)]
mesa: add gl_texture_image::Face, Level fields

Several drivers have these fields in their subclasses of gl_texture_image.
They'll be useful for core Mesa too...

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
13 years agox11: add missing comma to fix compilation
Brian Paul [Wed, 24 Aug 2011 13:55:04 +0000 (07:55 -0600)]
x11: add missing comma to fix compilation

13 years agor600g: fill out missing entries in opcode tables.
Dave Airlie [Wed, 24 Aug 2011 12:27:06 +0000 (13:27 +0100)]
r600g: fill out missing entries in opcode tables.

this just adds the missing opcodes as unsupported.

Signed-off-by: Dave Airlie <airlied@redhat.com>
13 years agowinsys/svga: use os_mmap() for memory mapping
Chia-I Wu [Sun, 21 Aug 2011 12:37:47 +0000 (20:37 +0800)]
winsys/svga: use os_mmap() for memory mapping

os_mmap() guarantees large file support across OSes.

13 years agowinsys/radeon: use os_mmap() for memory mapping
Chia-I Wu [Sun, 21 Aug 2011 04:31:45 +0000 (12:31 +0800)]
winsys/radeon: use os_mmap() for memory mapping

os_mmap() guarantees large file support across OSes.

Reviewed-by: Marek Olšák <maraeo@gmail.com>
13 years agoauxiliary/os: add wrappers for mmap/munmap
Chia-I Wu [Sun, 21 Aug 2011 03:58:30 +0000 (11:58 +0800)]
auxiliary/os: add wrappers for mmap/munmap

The use of mmap() in winsys requires large file support.  Not all OSes
have LFS so a wrapper should be used.  In particular, os_mmap() should
call __mmap2() on Android.

13 years agoi965: Only map the necessary buffer range in brw_prepare_indices
Ian Romanick [Mon, 22 Aug 2011 17:52:47 +0000 (10:52 -0700)]
i965: Only map the necessary buffer range in brw_prepare_indices

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agotnl: Only map the necessary buffer range in bind_indices
Ian Romanick [Mon, 22 Aug 2011 07:31:19 +0000 (00:31 -0700)]
tnl: Only map the necessary buffer range in bind_indices

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agomesa: Only map the necessary buffer range in vbo_get_minmax_index
Ian Romanick [Mon, 22 Aug 2011 07:14:51 +0000 (00:14 -0700)]
mesa: Only map the necessary buffer range in vbo_get_minmax_index

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agomesa: Eliminate dd_function_table::MapBuffer
Ian Romanick [Mon, 22 Aug 2011 01:34:27 +0000 (18:34 -0700)]
mesa: Eliminate dd_function_table::MapBuffer

Replace all calls to dd_function_table::MapBuffer with appropriate
calls to dd_function_table::MapBufferRange, then remove all the cruft.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agoradeon: Hack up an implementation of MapBufferRange
Ian Romanick [Mon, 22 Aug 2011 01:32:09 +0000 (18:32 -0700)]
radeon: Hack up an implementation of MapBufferRange

This doesn't implement any of the "cool" features of MapBufferRange.
Adding this function is necessary for the next commit in the series.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Alex Deucher <alexdeucher@gmail.com>
Cc: Maciej Cencora <m.cencora@gmail.com>
13 years agomesa: Fix incorrect access parameter passed to MapBuffer
Ian Romanick [Mon, 22 Aug 2011 01:45:06 +0000 (18:45 -0700)]
mesa: Fix incorrect access parameter passed to MapBuffer

The code previously passed GL_DYNAMIC_DRAW for the access parameter.
By inspection, I believe that all drivers would treat this as
GL_READ_WRITE because it's not GL_READ_ONLY and it's not
GL_WRITE_ONLY.

It appears the i965 code wants GL_WRITE_ONLY (it's about to write a
bunch of data in, never read data), while the arrayelt code is
GL_READ_ONLY (just dereffed as arguments to CALL_Whatever*v).

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Keith Whitwell <keithw@vmware.com>
13 years agomesa: Remove target parameter from dd_function_table::FlushMappedBufferRange
Ian Romanick [Mon, 22 Aug 2011 00:56:39 +0000 (17:56 -0700)]
mesa: Remove target parameter from dd_function_table::FlushMappedBufferRange

No driver used that parameter, and most drivers ended up with a bunch
of unused-parameter warnings because it was there.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agointel: Correctly check for read-only mappings in intel_bufferobj_map_range
Ian Romanick [Mon, 22 Aug 2011 00:55:33 +0000 (17:55 -0700)]
intel: Correctly check for read-only mappings in intel_bufferobj_map_range

The old code was an obvious cut-and-paste fail from intel_bufferobj_map.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Ben Widawsky <ben@bwidawsk.net>
13 years agomesa: Remove target parameter from dd_function_table::MapBufferRange
Ian Romanick [Mon, 22 Aug 2011 00:37:56 +0000 (17:37 -0700)]
mesa: Remove target parameter from dd_function_table::MapBufferRange

No driver used that parameter, and most drivers ended up with a bunch
of unused-parameter warnings because it was there.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agomesa: Remove target parameter from dd_function_table::GetBufferSubData
Ian Romanick [Mon, 22 Aug 2011 00:30:35 +0000 (17:30 -0700)]
mesa: Remove target parameter from dd_function_table::GetBufferSubData

No driver used that parameter, and most drivers ended up with a bunch
of unused-parameter warnings because it was there.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agomesa: Remove target parameter from dd_function_table::BufferSubData
Ian Romanick [Mon, 22 Aug 2011 00:23:58 +0000 (17:23 -0700)]
mesa: Remove target parameter from dd_function_table::BufferSubData

No driver used that parameter, and most drivers ended up with a bunch
of unused-parameter warnings because it was there.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agomesa: Remove target parameter from dd_function_table::MapBuffer
Ian Romanick [Mon, 22 Aug 2011 00:07:56 +0000 (17:07 -0700)]
mesa: Remove target parameter from dd_function_table::MapBuffer

No driver used that parameter, and most drivers ended up with a bunch
of unused-parameter warnings because it was there.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agomesa: Remove target parameter from dd_function_table::UnmapBuffer
Ian Romanick [Sun, 21 Aug 2011 23:59:30 +0000 (16:59 -0700)]
mesa: Remove target parameter from dd_function_table::UnmapBuffer

No driver used that parameter, and most drivers ended up with a bunch
of unused-parameter warnings because it was there.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agomake: Add missing source file.
José Fonseca [Tue, 23 Aug 2011 18:49:43 +0000 (19:49 +0100)]
make: Add missing source file.

13 years agoi965: Fix typo in 2b224d66a01f3ce867fb05558b25749705bbfe7a
Eric Anholt [Tue, 23 Aug 2011 17:51:16 +0000 (10:51 -0700)]
i965: Fix typo in 2b224d66a01f3ce867fb05558b25749705bbfe7a

Unfortunately, since a previous efficiency improvement, we no longer
have any open-source testcases producing register spilling, so this
code was untested in the fragment shader path.  That should change
when we get proper temporary array support in the fragment shader.

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

13 years agoi965/gen6+: Use non-normalized coordinates for GL_TEXTURE_RECTANGLE.
Eric Anholt [Wed, 17 Aug 2011 20:41:43 +0000 (13:41 -0700)]
i965/gen6+: Use non-normalized coordinates for GL_TEXTURE_RECTANGLE.

Improves performance of a GL_TEXTURE_RECTANGLE microbenchmark by 1.84%
+/- .15% (n=3)

13 years agoi965: Implement textureSize (TXS) on Gen4.
Kenneth Graunke [Wed, 17 Aug 2011 17:45:47 +0000 (10:45 -0700)]
i965: Implement textureSize (TXS) on Gen4.

Also, remove the BRW_SAMPLER_MESSAGE_SIMD8_RESINFO #define because
there totally isn't a SIMD8 variant.

Unfortunately, resinfo returns FLOAT32 on Broadwater/Crestline, unlike
G45 which returns a proper UINT32.  This turns out to be simple,
however: when we emit MOVs to select the desired half of the SIMD16
result, we can simply override the register type to be float so it's
converted to an integer.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
13 years agoi965/fs: Implement textureSize (TXS) on Gen5+.
Kenneth Graunke [Sun, 19 Jun 2011 08:47:50 +0000 (01:47 -0700)]
i965/fs: Implement textureSize (TXS) on Gen5+.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
13 years agoi965/fs: Rudimentary support for non-floating point texture results.
Kenneth Graunke [Thu, 18 Aug 2011 07:18:15 +0000 (00:18 -0700)]
i965/fs: Rudimentary support for non-floating point texture results.

Not all texturing operations return floating point data.  For example,
the resinfo message (textureSize or TXS) returns integer data.  In the
future, we'll also add integer texture support.

ir_texture's type field contains this information; use its base type to
appropriately type the destination register.  We want to keep it as a
four component vector, however, since SIMD8 samplers always have a
response length of 4.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
13 years agoglsl/builtins: Uncomment textureSize prototypes.
Kenneth Graunke [Fri, 25 Feb 2011 23:14:47 +0000 (15:14 -0800)]
glsl/builtins: Uncomment textureSize prototypes.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
13 years agotexture_builtins.py: Add support for textureSize (txs).
Kenneth Graunke [Fri, 25 Feb 2011 23:14:22 +0000 (15:14 -0800)]
texture_builtins.py: Add support for textureSize (txs).

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
13 years agoglsl: Add a new ir_txs (textureSize) opcode to ir_texture.
Kenneth Graunke [Fri, 25 Feb 2011 22:45:33 +0000 (14:45 -0800)]
glsl: Add a new ir_txs (textureSize) opcode to ir_texture.

One unique aspect of TXS is that it doesn't have a coordinate.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
13 years agost/xorg: Advertise support for XvMC
Maarten Lankhorst [Fri, 29 Jul 2011 17:37:51 +0000 (19:37 +0200)]
st/xorg: Advertise support for XvMC

Formats were based on a patch sent to xf86-video-nouveau by Bryan Cain

Signed-off-by: Maarten Lankhorst <m.b.lankhorst@gmail.com>
[Michel Dänzer: Add xorg_xvmc.c to SConscript.]

13 years agomesa: call _mesa_set_vp_override in glDrawTex*
Chia-I Wu [Thu, 24 Mar 2011 19:10:51 +0000 (03:10 +0800)]
mesa: call _mesa_set_vp_override in glDrawTex*

The driver may install its own vertex shader.  _mesa_set_vp_override
must be called so that core mesa can generate correct fragment program..

Reviewed-by: Brian Paul <brianp@vmware.com>
13 years agoauxiliary: share the source lists
Chia-I Wu [Fri, 19 Aug 2011 03:05:37 +0000 (11:05 +0800)]
auxiliary: share the source lists

Factor out source lists from Makefile to Makefile.sources, and let
Makefile, SConscript, and Android.mk share it.

Note that files in $(GENERATED_SOURCES) are removed from $(C_SOURCES).

Acked-by: José Fonseca <jfonseca@vmware.com>
Acked-by: Chad Versace <chad@chad-versace.us>
13 years agoscons: add ParseSourceList method
Chia-I Wu [Thu, 18 Aug 2011 09:12:29 +0000 (17:12 +0800)]
scons: add ParseSourceList method

ParseSourceList() can be used to parse a source list file and returns
the source files defined in it.  It is supposed to be used like this

  # get the list of source files from C_SOURCES in Makefile.sources
  sources = env.ParseSourceList('Makefile.sources', 'C_SOURCES')

The syntax of a source list file is compatible with GNU Make.  This
effectively allows SConscript and Makefile to share the source lists.

Acked-by: José Fonseca <jfonseca@vmware.com>
Acked-by: Chad Versace <chad@chad-versace.us>
13 years agoglsl: Make ir_validate actually visit ir_if nodes.
Kenneth Graunke [Thu, 18 Aug 2011 20:52:28 +0000 (13:52 -0700)]
glsl: Make ir_validate actually visit ir_if nodes.

There is no ir_hierarchical_visitor::visit(ir_if *) method, since ir_if
is not a leaf node.  Instead, there are visit_enter and visit_leave
methods.  Use visit_enter arbitrarily (either would work fine, though
visit_enter will catch errors sooner).

Found thanks to a warning emitted by Clang.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agointel: Abort when DRI2 separate stencil handshake fails
Chad Versace [Thu, 18 Aug 2011 00:35:07 +0000 (17:35 -0700)]
intel: Abort when DRI2 separate stencil handshake fails

When intel_context requires separate stencil but the DRI2 separate stencil
handshake fails, then abort and emit an error instructing the user to
upgrade the DDX to 2.16.0.

CC: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Chad Versace <chad@chad-versace.us>
13 years agoglsl_to_tgsi: Fix a few more struct vs. class warnings.
Kenneth Graunke [Mon, 22 Aug 2011 06:06:39 +0000 (23:06 -0700)]
glsl_to_tgsi: Fix a few more struct vs. class warnings.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agoglsl_to_tgsi: emit a MAD(b, -a, b) for !a && b
Bryan Cain [Sat, 20 Aug 2011 19:43:25 +0000 (14:43 -0500)]
glsl_to_tgsi: emit a MAD(b, -a, b) for !a && b

This is a port of commit ff2cfb8989cd to glsl_to_tgsi.

13 years agoglsl_to_tgsi: fix typo
Bryan Cain [Sat, 20 Aug 2011 19:17:52 +0000 (14:17 -0500)]
glsl_to_tgsi: fix typo

13 years agoglsl_to_tgsi: implement ir_binop_all_equal using DP4 w/SGE
Bryan Cain [Sat, 20 Aug 2011 19:15:03 +0000 (14:15 -0500)]
glsl_to_tgsi: implement ir_binop_all_equal using DP4 w/SGE

This is a port of commit ba01df11c4d0 to glsl_to_tgsi with integer support
added.

13 years agoglsl_to_tgsi: implement ir_binop_any_nequal using DP4 w/saturate or DP4 w/SLT
Bryan Cain [Sat, 20 Aug 2011 18:56:06 +0000 (13:56 -0500)]
glsl_to_tgsi: implement ir_binop_any_nequal using DP4 w/saturate or DP4 w/SLT

Implement the any() part of the operation the same way regular ir_unop_any
is implemented.

This is a port of commit e7bf096e8b04 to glsl_to_tgsi, with added integer
support.

13 years agoglsl_to_tgsi: implement ir_unop_any using DP4 w/saturate or DP4 w/SLT
Bryan Cain [Sat, 20 Aug 2011 18:26:12 +0000 (13:26 -0500)]
glsl_to_tgsi: implement ir_unop_any using DP4 w/saturate or DP4 w/SLT

This is a port of commit 92ca560d68e8 to glsl_to_tgsi, with integer support
added.

13 years agoglsl_to_tgsi: make glsl_to_tgsi_visitor::emit_dp return the instruction
Bryan Cain [Thu, 18 Aug 2011 01:34:19 +0000 (20:34 -0500)]
glsl_to_tgsi: make glsl_to_tgsi_visitor::emit_dp return the instruction

13 years agoglsl_to_tgsi: implement ir_binop_logic_or using an add w/saturate or add w/SLT
Bryan Cain [Wed, 17 Aug 2011 19:35:35 +0000 (14:35 -0500)]
glsl_to_tgsi: implement ir_binop_logic_or using an add w/saturate or add w/SLT

Logical-or is implemented using addition (followed by clamping to [0,1]) on
values of 0.0 and 1.0. Replacing the logical-or operators with addition gives
a + b which has a result on the range [0, 2].

Previously a SNE instruction was used to clamp the resulting logic value to
[0,1]. In a fragment shader, using a saturate on the add has the same effect.
Adding the saturate to the add is free, so (at least) one instruction is
saved. In a vertex shader, using an SLT on the negation of the add result has
the same effect. Many older shader architectures do not support the SNE
instruction. It must be emulated using two SLT instructions and an ADD. On
these architectures, the single SLT saves two instructions.

Note that SNE is still used when integers are used for boolean values, since
there is no such thing as an integer saturate, and older shader architectures
without SNE don't support integers.

This is a port of commit 41f8ffe5e07c to glsl_to_tgsi with integer support
added.

13 years agoglsl_to_tgsi: implement ir_unop_logic_not using 1-x
Bryan Cain [Wed, 17 Aug 2011 15:01:30 +0000 (10:01 -0500)]
glsl_to_tgsi: implement ir_unop_logic_not using 1-x

Since our logic values are 0.0 (false) and 1.0 (true), 1.0 - x accurately
implements logical not.

This is a port of commit 6ad08989d7c1 to glsl_to_tgsi.

13 years agost/egl: add a missing include
Chia-I Wu [Tue, 2 Aug 2011 00:49:27 +0000 (09:49 +0900)]
st/egl: add a missing include

Reported by cwhuang.

13 years agost/egl: improve error logging
Chia-I Wu [Thu, 4 Aug 2011 02:49:42 +0000 (11:49 +0900)]
st/egl: improve error logging

This helps diagnose problems in EGL initialization.

13 years agost/egl: add buffer preserving support to Android
Chia-I Wu [Sun, 31 Jul 2011 02:16:53 +0000 (11:16 +0900)]
st/egl: add buffer preserving support to Android

Use a staging color buffer when buffer preserving is enabled.

13 years agost/egl: improve buffer cache for Android
Chia-I Wu [Sun, 31 Jul 2011 01:49:52 +0000 (10:49 +0900)]
st/egl: improve buffer cache for Android

There may be more than two back buffers.  Clean up and prepare the
buffer cache for that.

13 years agost/egl: swapping without a buffer is not an error
Chia-I Wu [Wed, 20 Jul 2011 10:20:20 +0000 (18:20 +0800)]
st/egl: swapping without a buffer is not an error

This fixes Kwaak3.

13 years agost/egl: use HAL formats for Android backend
Chia-I Wu [Sat, 30 Jul 2011 01:45:20 +0000 (10:45 +0900)]
st/egl: use HAL formats for Android backend

Native buffers use HAL formats, not UI formats.

13 years agowinsys/sw/android: use HAL formats
Chia-I Wu [Sun, 31 Jul 2011 03:08:24 +0000 (12:08 +0900)]
winsys/sw/android: use HAL formats

Native buffers use HAL formats, not UI formats.

13 years agowinsys/sw/android: set bo usage correctly
Chia-I Wu [Thu, 4 Aug 2011 08:50:51 +0000 (17:50 +0900)]
winsys/sw/android: set bo usage correctly

Since this is the software path, set GRALLOC_USAGE_SW_WRITE_OFTEN when
PIPE_BIND_RENDER_TARGET, and set GRALLOC_USAGE_SW_READ_OFTEN when
PIPE_BIND_SAMPLER_VIEW.

13 years agoandroid: make libGLES_mesa real
Chia-I Wu [Wed, 17 Aug 2011 04:19:23 +0000 (12:19 +0800)]
android: make libGLES_mesa real

libGLES_mesa with swrast should link in these libraries

  libmesa_egl
  libmesa_egl_gallium
  libmesa_st_egl
  libmesa_st_mesa
  libmesa_glsl
  libmesa_glsl_utils
  libmesa_pipe_softpipe
  libmesa_winsys_sw_android
  libmesa_gallium

Reviewed-by: Chad Versace <chad@chad-versace.us>
13 years agoandroid: build shared glapi
Chia-I Wu [Wed, 17 Aug 2011 04:10:12 +0000 (12:10 +0800)]
android: build shared glapi

This builds the shared library libglapi from shared glapi.

Reviewed-by: Chad Versace <chad@chad-versace.us>
13 years agoandroid: build glsl
Chia-I Wu [Wed, 17 Aug 2011 03:56:43 +0000 (11:56 +0800)]
android: build glsl

This builds the static library libmesa_glsl and executable glsl_compiler
from glsl.  glsl_compiler is only installed for engineering build.

Reviewed-by: Chad Versace <chad@chad-versace.us>
13 years agoandroid: build core mesa
Chia-I Wu [Wed, 17 Aug 2011 03:31:36 +0000 (11:31 +0800)]
android: build core mesa

This builds the static library libmesa_st_mesa from core mesa.

Acked-by: Chad Versace <chad@chad-versace.us>
13 years agoandroid: build core EGL
Chia-I Wu [Wed, 17 Aug 2011 03:24:11 +0000 (11:24 +0800)]
android: build core EGL

This builds the static library libmesa_egl from core EGL.

Reviewed-by: Chad Versace <chad@chad-versace.us>
13 years agoandroid: build softpipe
Chia-I Wu [Wed, 17 Aug 2011 03:51:08 +0000 (11:51 +0800)]
android: build softpipe

This builds the static library libmesa_pipe_softpipe from softpipe.

13 years agoandroid: build android sw winsys
Chia-I Wu [Wed, 17 Aug 2011 03:47:42 +0000 (11:47 +0800)]
android: build android sw winsys

This builds the static library libmesa_winsys_sw_android from winsys/sw.

13 years agoandroid: build targets/egl-static
Chia-I Wu [Thu, 18 Aug 2011 16:28:22 +0000 (00:28 +0800)]
android: build targets/egl-static

This builds the static library libmesa_egl_gallium from
targets/egl-static.

13 years agoandroid: build st/egl with android backend
Chia-I Wu [Wed, 17 Aug 2011 03:41:40 +0000 (11:41 +0800)]
android: build st/egl with android backend

This builds the static library libmesa_st_egl from st/egl.

13 years agoandroid: build gallium auxiliaries
Chia-I Wu [Wed, 17 Aug 2011 03:38:00 +0000 (11:38 +0800)]
android: build gallium auxiliaries

This builds the static library libmesa_gallium from gallium auxiliaries.

13 years agoandroid: build libGLES_mesa
Chia-I Wu [Wed, 17 Aug 2011 03:07:01 +0000 (11:07 +0800)]
android: build libGLES_mesa

This is the first step to integrate Mesa into Android(-x86) build
system.  You can git clone mesa under the external/ directory of Android
source tree and build Android with

 $ make BOARD_GPU_DRIVERS=swrast

It will build libGLES_mesa that will be loaded by Android runtime.

libGLES_mesa is still a stub in this commit.

13 years agotargets/egl-static: do not rely on libudev on Android
Chia-I Wu [Thu, 18 Aug 2011 02:24:25 +0000 (10:24 +0800)]
targets/egl-static: do not rely on libudev on Android

There is no libudev on Android.  Use DRM to get the PCI ID directly.

Reviewed-by: Benjamin Franzke <benjaminfranzke@googlemail.com>
13 years agost/egl: add android backend
Chia-I Wu [Thu, 18 Aug 2011 02:28:29 +0000 (10:28 +0800)]
st/egl: add android backend

Both HW and SW rendering are supported for Android.  For SW rendering,
we use the generic gralloc lock/unlock for mapping and unmapping color
buffers (in winsys/android).

For HW rendering, we need to know the real type of color buffers.  This
backend works with drm_gralloc, where a color buffer is backed by a GEM
object.

13 years agowinsys/android: new SW winsys for Android
Chia-I Wu [Thu, 18 Aug 2011 02:17:10 +0000 (10:17 +0800)]
winsys/android: new SW winsys for Android

On Android, color buffers are passed between server and clients as
opaque buffer_handle_t.  This winsys makes use of gralloc, which
provides a generic way to map and unmap buffer_handle_t for CPU access.

13 years agoegl: add Android-specific extensions
Chia-I Wu [Fri, 1 Oct 2010 19:27:42 +0000 (15:27 -0400)]
egl: add Android-specific extensions

Add EGL_ANDROID_image_native_buffer and EGL_ANDROID_swap_rectangle.
There is no spec for them though.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Chad Versace <chad@chad-versace.us>
13 years agoegl: add _EGL_PLATFORM_ANDROID
Chia-I Wu [Mon, 11 Oct 2010 08:09:52 +0000 (16:09 +0800)]
egl: add _EGL_PLATFORM_ANDROID

This is Android Gingerbread platform.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Chad Versace <chad@chad-versace.us>
13 years agomesa: android has no log2f nor ffs
Chia-I Wu [Fri, 5 Aug 2011 03:54:05 +0000 (12:54 +0900)]
mesa: android has no log2f nor ffs

Define log2f(v) to be logf(v) / M_LN2 and ffs to __builtin_ffs.

Reviewed-by: Chad Versace <chad@chad-versace.us>
13 years agoralloc: include limits.h for SIZE_MAX on Android
Chia-I Wu [Fri, 5 Aug 2011 03:52:49 +0000 (12:52 +0900)]
ralloc: include limits.h for SIZE_MAX on Android

Android does not define SIZE_MAX in stdint.h.  We have to include
limits.h for it.

Reviewed-by: Chad Versace <chad@chad-versace.us>
13 years agogallium: add PIPE_OS_ANDROID support
Chia-I Wu [Fri, 5 Aug 2011 03:50:12 +0000 (12:50 +0900)]
gallium: add PIPE_OS_ANDROID support

Android uses Linux kernel and its own C runtime.  It resembles
PIPE_OS_LINUX a lot with some minor exceptions.

Reviewed-by: Brian Paul <brianp@vmware.com>
13 years agoglsl: remove an unnecessary header include
Chia-I Wu [Mon, 1 Aug 2011 02:14:18 +0000 (11:14 +0900)]
glsl: remove an unnecessary header include

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Chad Versace <chad@chad-versace.us>
13 years agomesa: fix !FEATURE_GL build
Chia-I Wu [Fri, 8 Apr 2011 14:50:43 +0000 (22:50 +0800)]
mesa: fix !FEATURE_GL build

Move vbo_exec_FlushVertices_internal out of FEATURE_beginend.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Chad Versace <chad@chad-versace.us>
13 years agoi965/gen7: Use align1 mode to set URB_WRITE_HWORD channel enables.
Kenneth Graunke [Thu, 18 Aug 2011 09:15:56 +0000 (02:15 -0700)]
i965/gen7: Use align1 mode to set URB_WRITE_HWORD channel enables.

Makes the new vertex shader backend work on Ivybridge.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agoi965/fs: Don't double-convert integer/boolean uniforms.
Kenneth Graunke [Thu, 11 Aug 2011 23:42:01 +0000 (16:42 -0700)]
i965/fs: Don't double-convert integer/boolean uniforms.

When ctx->Const.NativeIntegers is set, Core Mesa loads integer/boolean
uniforms directly, rather than loading the floating point equivalent.
So, when that's set, we don't need to perform any conversions.

Unfortunately, we can't properly support native integers with the old
vertex shader backend, so this patch leaves them disabled for now.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agomesa, glsl_to_tgsi: Add new gl_context::NativeIntegers flag.
Kenneth Graunke [Mon, 15 Aug 2011 21:18:16 +0000 (14:18 -0700)]
mesa, glsl_to_tgsi: Add new gl_context::NativeIntegers flag.

Previously, native integer support was based on whether the driver
advertised GLSL 1.30 or not.  However, drivers that natively support
integers may wish to do so for older GLSL versions as well.  Adding this
new opt-in flag allows them to do so.

Currently disabled by default on all drivers, which was the existing
behavior (no drivers currently implement GLSL 1.30).

Fixes piglit tests on i965 with INTEL_GLSL_VERSION=130 set:
- spec/glsl-1.10/fs-uniform-int-110.shader_test
- spec/glsl-1.30/fs-uniform-int-130.shader_test
(it was doubly converting the data)

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agoir_to_mesa: Remove incorrect usage of the 'struct' keyword on classes.
Kenneth Graunke [Thu, 18 Aug 2011 21:08:06 +0000 (14:08 -0700)]
ir_to_mesa: Remove incorrect usage of the 'struct' keyword on classes.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agoi965/fs: Change incorrect use of 'struct fs_reg' to simply 'fs_reg'.
Kenneth Graunke [Thu, 18 Aug 2011 21:05:11 +0000 (14:05 -0700)]
i965/fs: Change incorrect use of 'struct fs_reg' to simply 'fs_reg'.

It's actually a class.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agoglsl: Remove unused variable.
Kenneth Graunke [Thu, 18 Aug 2011 21:03:26 +0000 (14:03 -0700)]
glsl: Remove unused variable.

13 years agoi965/vs: Implement proper register allocation instead of 1:1 mapping.
Eric Anholt [Tue, 16 Aug 2011 22:28:53 +0000 (15:28 -0700)]
i965/vs: Implement proper register allocation instead of 1:1 mapping.

Fixes vs-atan-* and several others.  This is not the real solution we
eventually want, which will pack floats, vec2s, and vec3s into vec4
registers, but this code should provide the framework for that.

13 years agoi965/vs: Add simple dead code elimination.
Eric Anholt [Wed, 17 Aug 2011 17:50:17 +0000 (10:50 -0700)]
i965/vs: Add simple dead code elimination.

This is copied right from the fragment shader.  It is needed for real
register allocation to work correctly.

13 years agoi965/vs: Copy the live intervals calculation over from the FS.
Eric Anholt [Tue, 16 Aug 2011 22:09:48 +0000 (15:09 -0700)]
i965/vs: Copy the live intervals calculation over from the FS.

This is a rather pessimistic calculation, since it doesn't distinguish
individual channels of a vec4, or elements of an array, but should be
a minimum start for register allocation.

13 years agoi965/vs: Remove stale comment about compressed instructions.
Eric Anholt [Tue, 16 Aug 2011 21:18:51 +0000 (14:18 -0700)]
i965/vs: Remove stale comment about compressed instructions.

This was copy'n'paste from the fragment shader, and didn't make sense
here.

13 years agor600g: don't allocate separate depth and stencil for transfer textures on EG
Marek Olšák [Fri, 19 Aug 2011 20:57:56 +0000 (22:57 +0200)]
r600g: don't allocate separate depth and stencil for transfer textures on EG

The state tracker expects depth and stencil pixels interleaved.
Evergreen can bind an interleaved depth-stencil resource as a colorbuffer,
but not as a zbuffer.

The hardware can do the interleaving for us when decompressing.