mesa.git
13 years agoi965/vs: Track the variable index of array accesses.
Eric Anholt [Sun, 7 Aug 2011 17:59:39 +0000 (10:59 -0700)]
i965/vs: Track the variable index of array accesses.

This isn't used currently, as we lower all array accesses.

13 years agoi965: Add remaining scratch space setup emit to unit states.
Eric Anholt [Sun, 7 Aug 2011 17:47:54 +0000 (10:47 -0700)]
i965: Add remaining scratch space setup emit to unit states.

13 years agoi965: Set up allocation of a VS scratch space if required.
Eric Anholt [Sun, 7 Aug 2011 17:44:15 +0000 (10:44 -0700)]
i965: Set up allocation of a VS scratch space if required.

13 years agoi965: Remove dead brw->wm.max_threads field.
Eric Anholt [Sun, 7 Aug 2011 17:43:49 +0000 (10:43 -0700)]
i965: Remove dead brw->wm.max_threads field.

13 years agoi965/vs: Add support for VUEs larger than a single URB write.
Eric Anholt [Sat, 6 Aug 2011 04:53:00 +0000 (21:53 -0700)]
i965/vs: Add support for VUEs larger than a single URB write.

Fixes glsl-max-varyings.

13 years agoi965/vs: Avoid generating extra moves when setting up large ir_constants.
Eric Anholt [Sat, 6 Aug 2011 04:22:36 +0000 (21:22 -0700)]
i965/vs: Avoid generating extra moves when setting up large ir_constants.

We were also screwing up the types in the process, and just not
emitting moves was easier.

13 years agoi965/vs: Fix types of varying outputs.
Eric Anholt [Sat, 6 Aug 2011 03:54:25 +0000 (20:54 -0700)]
i965/vs: Fix types of varying outputs.

For structs/arrays/matrices, they were ending up as uint because we
forgot to set them.  All varyings in GLSL 1.20 are of base type float,
so just force the matter here (which gets inherited at
emit_urb_writes() time).

Fixes vs-varying-array-mat2-col-rd.

13 years agoi965/vs: Handle assignment of structures/arrays/matrices better.
Eric Anholt [Sat, 6 Aug 2011 03:46:03 +0000 (20:46 -0700)]
i965/vs: Handle assignment of structures/arrays/matrices better.

This gets the right types on the instructions, as well as emitting
minimal swizzles/writemasks.

13 years agoi965/vs: Don't forget to set up assignment condition code for arrays/structs.
Eric Anholt [Sat, 6 Aug 2011 03:26:48 +0000 (20:26 -0700)]
i965/vs: Don't forget to set up assignment condition code for arrays/structs.

Fixes vs-uniform-array-mat2-index-col-rd.

13 years agoi965/vs: Apply the gen6 math workaround for math1 instructions.
Eric Anholt [Sat, 6 Aug 2011 03:16:21 +0000 (20:16 -0700)]
i965/vs: Apply the gen6 math workaround for math1 instructions.

Fixes glsl-vs-masked-cos.

13 years agoi965/vs: Add support for if(any_nequal()) and if(all_equal()) on gen6.
Eric Anholt [Sat, 6 Aug 2011 03:03:31 +0000 (20:03 -0700)]
i965/vs: Add support for if(any_nequal()) and if(all_equal()) on gen6.

Fixes vs-temp-array-mat2-col-rd.shader_test.

13 years agoi965/vs: Add support for dot product opcodes.
Eric Anholt [Sat, 6 Aug 2011 02:40:46 +0000 (19:40 -0700)]
i965/vs: Add support for dot product opcodes.

Fixes glsl-vs-dot-vec2.

13 years agoi965/vs: Fix the types of array/struct dereferences.
Eric Anholt [Sat, 6 Aug 2011 02:38:44 +0000 (19:38 -0700)]
i965/vs: Fix the types of array/struct dereferences.

Fixes glsl-vs-arrays-3.

13 years agoi965/vs: Drop the assertion about dst.reg_offset == 0.
Eric Anholt [Sat, 6 Aug 2011 02:31:53 +0000 (19:31 -0700)]
i965/vs: Drop the assertion about dst.reg_offset == 0.

Adding the offset is the right thing to do here, and fixes
glsl-vs-mat-add-1.

13 years agoi965/vs: Use an appropriate swizzle on src regs from variables.
Eric Anholt [Sat, 6 Aug 2011 02:29:41 +0000 (19:29 -0700)]
i965/vs: Use an appropriate swizzle on src regs from variables.

Fixes glsl-vs-if-bool.

13 years agoi965/vs: Fix support for zero uniforms in use.
Eric Anholt [Sat, 6 Aug 2011 02:18:31 +0000 (19:18 -0700)]
i965/vs: Fix support for zero uniforms in use.

We were looking for attributes in the wrong place, and pointlessly
doing the work on gen6 at all.

13 years agoi965/vs: Fix support for "IF" instructions by copying brw_fs_visitor.cpp.
Eric Anholt [Sat, 6 Aug 2011 02:12:16 +0000 (19:12 -0700)]
i965/vs: Fix support for "IF" instructions by copying brw_fs_visitor.cpp.

Fixes glsl-vs-if-greater.

13 years agoi965/vs: Disable loops for now until rendering is generally correct.
Eric Anholt [Sat, 6 Aug 2011 02:05:42 +0000 (19:05 -0700)]
i965/vs: Disable loops for now until rendering is generally correct.

13 years agoi965/vs: Fix ir_swizzle handling.
Eric Anholt [Fri, 5 Aug 2011 23:37:18 +0000 (16:37 -0700)]
i965/vs: Fix ir_swizzle handling.

I decided to refactor it a bit in adapting ir_to_mesa.cpp code, and
mangled it.  Fixes glsl-vs-cross-2.

13 years agoi965/vs: Allocate storage for "auto" variables just like temps.
Eric Anholt [Fri, 5 Aug 2011 23:35:24 +0000 (16:35 -0700)]
i965/vs: Allocate storage for "auto" variables just like temps.

Fixes segfault in glsl-vs-cross-2.

13 years agoi965/vs: Allow scalar values in assignments, too.
Eric Anholt [Fri, 5 Aug 2011 23:31:30 +0000 (16:31 -0700)]
i965/vs: Allow scalar values in assignments, too.

Fixes glsl-vs-all-02 and many other tests.

13 years agoi965/vs: Don't emit an extra copy of the vertex position.
Eric Anholt [Fri, 5 Aug 2011 23:29:48 +0000 (16:29 -0700)]
i965/vs: Don't emit an extra copy of the vertex position.

Fixes glsl-vs-abs-neg, glsl-vs-all-01, and probably many other tests.

13 years agoi965/vs: Port the fix for clip plane writemasks from brw_vs_emit.c.
Eric Anholt [Fri, 5 Aug 2011 23:23:42 +0000 (16:23 -0700)]
i965/vs: Port the fix for clip plane writemasks from brw_vs_emit.c.

13 years agoi965/vs: Fix constant vector construction.
Eric Anholt [Fri, 5 Aug 2011 23:18:00 +0000 (16:18 -0700)]
i965/vs: Fix constant vector construction.

Fixes some issues noticed in glsl-vs-all-01.

13 years agoi965/vs: Start adding support for uniforms
Eric Anholt [Wed, 4 May 2011 19:50:16 +0000 (12:50 -0700)]
i965/vs: Start adding support for uniforms

There's no clever packing here, no pull constants, and no array support.

13 years agoi965: Start adding the VS visitor and codegen.
Eric Anholt [Mon, 2 May 2011 16:45:40 +0000 (09:45 -0700)]
i965: Start adding the VS visitor and codegen.

The low-level IR is a mashup of brw_fs.cpp and ir_to_mesa.cpp.  It's
currently controlled by the INTEL_NEW_VS=1 environment variable, and
only tested for the trivial "gl_Position = gl_Vertex;" shader so far.

13 years agoi965: Rename math FS_OPCODE_* to SHADER_OPCODE_*.
Eric Anholt [Fri, 5 Aug 2011 19:38:58 +0000 (12:38 -0700)]
i965: Rename math FS_OPCODE_* to SHADER_OPCODE_*.

I want to just use the same enums in the VS.

13 years agoi965: Create a shared enum for hardware and compiler-internal opcodes.
Eric Anholt [Tue, 3 May 2011 17:55:50 +0000 (10:55 -0700)]
i965: Create a shared enum for hardware and compiler-internal opcodes.

This should make gdbing more pleasant, and it might be used in sharing
part of the codegen between the VS and FS backends.

13 years agoi965: Generate driver-specific IR for non-fragment shaders as well.
Eric Anholt [Tue, 3 May 2011 22:27:38 +0000 (15:27 -0700)]
i965: Generate driver-specific IR for non-fragment shaders as well.

This will be used by the new vertex shader backend.  The scalarizing
passes are skipped for non-fragment, since vertex and geometry threads
are based on vec4s.

13 years agomesa: ChooseTextureFormat() returns gl_format, not GLuint
Brian Paul [Tue, 16 Aug 2011 19:05:26 +0000 (13:05 -0600)]
mesa: ChooseTextureFormat() returns gl_format, not GLuint

13 years agoglsl: Fix type error when lowering integer divisions
Paul Berry [Fri, 12 Aug 2011 17:20:34 +0000 (10:20 -0700)]
glsl: Fix type error when lowering integer divisions

This patch fixes a bug when lowering an integer division:

  x/y

to a multiplication by a reciprocal:

  int(float(x)*reciprocal(float(y)))

If x was a plain int and y was an ivecN, the lowering pass
incorrectly assigned the type of the product to be float, when in fact
it should be vecN.  This caused mesa to abort with an IR validation
error.

Fixes piglit tests {fs,vs}-op-div-int-ivec{2,3,4}.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agosoftpipe: fix an obvious copy-paste error in get_query_result
Marek Olšák [Tue, 16 Aug 2011 17:06:55 +0000 (19:06 +0200)]
softpipe: fix an obvious copy-paste error in get_query_result

Reviewed-by: Brian Paul <brianp@vmware.com>
13 years agost/dri: remove an unused-but-set variable
Marek Olšák [Tue, 16 Aug 2011 16:48:11 +0000 (18:48 +0200)]
st/dri: remove an unused-but-set variable

13 years agor600g: rename bc -> bytecode
Marek Olšák [Tue, 16 Aug 2011 17:35:10 +0000 (19:35 +0200)]
r600g: rename bc -> bytecode

It took me a while to figure out what it stands for.

13 years agoegl: Add include paths for platform autodetection
Benjamin Franzke [Tue, 16 Aug 2011 17:23:18 +0000 (19:23 +0200)]
egl: Add include paths for platform autodetection

Needed since commit 85fe9484.

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

13 years agodri2: check if context is valid before flushing the pipe
Cooper Yuan [Tue, 16 Aug 2011 12:37:13 +0000 (20:37 +0800)]
dri2: check if context is valid before flushing the pipe

13 years agor600g: expose ARB_ES2_compatibility by claiming fixed-point format support
Marek Olšák [Mon, 15 Aug 2011 21:37:44 +0000 (23:37 +0200)]
r600g: expose ARB_ES2_compatibility by claiming fixed-point format support

I also needed to make some changes in u_vbuf_mgr in order to override
the caps from the driver and enable the fallback even though the driver
claims the format is supported.

13 years agonoop: redirect the get_param/is_format.. queries to the underlying driver
Marek Olšák [Mon, 15 Aug 2011 17:37:33 +0000 (19:37 +0200)]
noop: redirect the get_param/is_format.. queries to the underlying driver

13 years agou_blitter: restore some states conditionally
Marek Olšák [Mon, 15 Aug 2011 18:52:44 +0000 (20:52 +0200)]
u_blitter: restore some states conditionally

13 years agou_blitter: rename util_blitter_copy_region -> util_blitter_copy_texture
Marek Olšák [Wed, 10 Aug 2011 00:58:40 +0000 (02:58 +0200)]
u_blitter: rename util_blitter_copy_region -> util_blitter_copy_texture

13 years agor600g: consolidate two files r600d.h
Marek Olšák [Sun, 14 Aug 2011 19:21:38 +0000 (21:21 +0200)]
r600g: consolidate two files r600d.h

13 years agor600g: set read/write usage flags for each relocation
Marek Olšák [Sun, 7 Aug 2011 19:14:38 +0000 (21:14 +0200)]
r600g: set read/write usage flags for each relocation

This takes advantage of the new GEM_WAIT ioctl when mapping buffers.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
13 years agowinsys/radeon: take advantage of the new ioctl
Marek Olšák [Sun, 7 Aug 2011 17:18:16 +0000 (19:18 +0200)]
winsys/radeon: take advantage of the new ioctl

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
13 years agowinsys/radeon: hook up the new DRM_RADEON_GEM_WAIT ioctl
Marek Olšák [Sun, 7 Aug 2011 17:04:37 +0000 (19:04 +0200)]
winsys/radeon: hook up the new DRM_RADEON_GEM_WAIT ioctl

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
13 years agowinsys/radeon: remove broken bo-is-busy-for-write guessing
Marek Olšák [Sun, 7 Aug 2011 16:42:29 +0000 (18:42 +0200)]
winsys/radeon: remove broken bo-is-busy-for-write guessing

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
13 years agor600g: enable thread offloading
Marek Olšák [Thu, 4 Aug 2011 05:05:07 +0000 (07:05 +0200)]
r600g: enable thread offloading

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
13 years agor600g: undefine RADEON_CTX_MAX_PM4
Marek Olšák [Thu, 4 Aug 2011 04:33:04 +0000 (06:33 +0200)]
r600g: undefine RADEON_CTX_MAX_PM4

winsys/radeon has its own definition.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
13 years agor600g: don't include radeon_drm.h and xf86drm.h
Marek Olšák [Thu, 4 Aug 2011 04:23:59 +0000 (06:23 +0200)]
r600g: don't include radeon_drm.h and xf86drm.h

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
13 years agowinsys/radeon: remove the device file descriptor from the interface
Marek Olšák [Thu, 4 Aug 2011 04:19:17 +0000 (06:19 +0200)]
winsys/radeon: remove the device file descriptor from the interface

r600g doesn't need it anymore.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
13 years agor600g: remove an unused parameter from r600_bo_destroy
Marek Olšák [Thu, 4 Aug 2011 04:17:39 +0000 (06:17 +0200)]
r600g: remove an unused parameter from r600_bo_destroy

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
13 years agor600g: merge radeon_bo with r600_bo
Marek Olšák [Thu, 4 Aug 2011 04:11:45 +0000 (06:11 +0200)]
r600g: merge radeon_bo with r600_bo

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
13 years agor600g: remove radeon_bo::handle
Marek Olšák [Thu, 4 Aug 2011 03:40:16 +0000 (05:40 +0200)]
r600g: remove radeon_bo::handle

This should be private to radeon_winsys.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
13 years agor600g: use buffer_map/unmap from radeon_winsys
Marek Olšák [Thu, 4 Aug 2011 02:27:48 +0000 (04:27 +0200)]
r600g: use buffer_map/unmap from radeon_winsys

This also drops the unneeded bo_busy/wait functions.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
13 years agor600g: set the flush callback in radeon_winsys
Marek Olšák [Thu, 4 Aug 2011 01:38:20 +0000 (03:38 +0200)]
r600g: set the flush callback in radeon_winsys

I have also renamed the winsys function.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
13 years agor600g: get tiling flags using radeon_winsys
Marek Olšák [Thu, 4 Aug 2011 01:19:33 +0000 (03:19 +0200)]
r600g: get tiling flags using radeon_winsys

Also remove some unused fence-related leftovers.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
13 years agor600g: get winsys_handle using radeon_winsys
Marek Olšák [Thu, 4 Aug 2011 01:07:42 +0000 (03:07 +0200)]
r600g: get winsys_handle using radeon_winsys

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
13 years agor600g: move more DRM queries into winsys/radeon
Marek Olšák [Thu, 4 Aug 2011 01:01:44 +0000 (03:01 +0200)]
r600g: move more DRM queries into winsys/radeon

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
13 years agowinsys/radeon: consolidate the add_reloc function
Marek Olšák [Thu, 4 Aug 2011 00:36:57 +0000 (02:36 +0200)]
winsys/radeon: consolidate the add_reloc function

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
13 years agor600g: emit CS using radeon_winsys
Marek Olšák [Wed, 3 Aug 2011 23:37:33 +0000 (01:37 +0200)]
r600g: emit CS using radeon_winsys

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
13 years agor600g: remove struct r600_reloc
Marek Olšák [Wed, 3 Aug 2011 22:15:54 +0000 (00:15 +0200)]
r600g: remove struct r600_reloc

That is really private to winsys/radeon.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
13 years agor600g: don't use RADEON_GEM_DOMAIN_CPU
Marek Olšák [Wed, 3 Aug 2011 17:27:49 +0000 (19:27 +0200)]
r600g: don't use RADEON_GEM_DOMAIN_CPU

Also staging resources shouldn't be allocated with the initial domain
being VRAM.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
13 years agor600g: remove reloc-related variables from radeon_bo
Marek Olšák [Wed, 3 Aug 2011 03:15:36 +0000 (05:15 +0200)]
r600g: remove reloc-related variables from radeon_bo

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
13 years agor600g: let radeon_winsys maintain the list of relocations
Marek Olšák [Wed, 3 Aug 2011 02:31:02 +0000 (04:31 +0200)]
r600g: let radeon_winsys maintain the list of relocations

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
13 years agor600g: remove now-unused r600_context::fenced_bo
Marek Olšák [Wed, 3 Aug 2011 00:24:15 +0000 (02:24 +0200)]
r600g: remove now-unused r600_context::fenced_bo

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
13 years agor600g: remove the fences which were used for the cache buffer manager
Marek Olšák [Tue, 2 Aug 2011 23:59:02 +0000 (01:59 +0200)]
r600g: remove the fences which were used for the cache buffer manager

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
13 years agor600g: remove now-unused r600_bo::size
Marek Olšák [Tue, 2 Aug 2011 23:47:57 +0000 (01:47 +0200)]
r600g: remove now-unused r600_bo::size

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
13 years agor600g: remove the cache buffer manager from winsys/r600
Marek Olšák [Tue, 2 Aug 2011 23:34:39 +0000 (01:34 +0200)]
r600g: remove the cache buffer manager from winsys/r600

As we've just started using the one from winsys/radeon.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
13 years agor600g: allocate/destroy buffers using radeon_winsys
Marek Olšák [Tue, 2 Aug 2011 23:03:13 +0000 (01:03 +0200)]
r600g: allocate/destroy buffers using radeon_winsys

We use the cache buffer manager from radeon_winsys now, but we don't use
anything else yet.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
13 years agor600g: remove unused function declarations
Marek Olšák [Tue, 2 Aug 2011 21:58:57 +0000 (23:58 +0200)]
r600g: remove unused function declarations

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
13 years agor600g: remove unused r600_bo::tiling_flags
Marek Olšák [Tue, 2 Aug 2011 21:03:11 +0000 (23:03 +0200)]
r600g: remove unused r600_bo::tiling_flags

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
13 years agor600g: remove unused r600_bo::kernel_pitch
Marek Olšák [Tue, 2 Aug 2011 19:18:10 +0000 (21:18 +0200)]
r600g: remove unused r600_bo::kernel_pitch

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
13 years agor600g: put radeon_winsys in screen::winsys, don't include drm_driver in the pipe
Marek Olšák [Tue, 2 Aug 2011 18:25:13 +0000 (20:25 +0200)]
r600g: put radeon_winsys in screen::winsys, don't include drm_driver in the pipe

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
13 years agor600g: cleanup includes in winsys
Marek Olšák [Fri, 22 Jul 2011 19:38:56 +0000 (21:38 +0200)]
r600g: cleanup includes in winsys

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
13 years agor600g: move some queries into winsys/radeon
Marek Olšák [Fri, 22 Jul 2011 18:15:47 +0000 (20:15 +0200)]
r600g: move some queries into winsys/radeon

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
13 years agor600g: first step into winsys/radeon
Marek Olšák [Fri, 22 Jul 2011 17:25:07 +0000 (19:25 +0200)]
r600g: first step into winsys/radeon

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
13 years agodri2: Add __DRI_BUFFER_COUNT token
Benjamin Franzke [Mon, 15 Aug 2011 07:50:19 +0000 (09:50 +0200)]
dri2: Add __DRI_BUFFER_COUNT token

Remove definition from egl_dri2.
Defining this is egl_dri2.h breaks as soon as
a new dri2 buffer token is added like with commit
4501a5d6e8d00fd0d87625352ed5ba1a8861f72e.

13 years agodri2: add code to dri2_Flush extension.
Cooper Yuan [Tue, 16 Aug 2011 01:32:10 +0000 (09:32 +0800)]
dri2: add code to dri2_Flush extension.

It's going to flush client's commands in eglWaitClient(). Before this,
egl applications using pixmap or pbuffer flicker because of no flush.

Reviewed-by: Alan Hourihane
13 years agoglsl: When assigning to a whole array, mark the array as accessed.
Eric Anholt [Sat, 6 Aug 2011 04:40:50 +0000 (21:40 -0700)]
glsl: When assigning to a whole array, mark the array as accessed.

The vs-varying-array-mat2-col-row-wr test writes a mat2[3] constant to
a mat2[3] varying out array, and also statically accesses element 1 of
it on the VS and FS sides.  At link time it would get trimmed down to
just 2 elements, and then codegen of the VS would end up generating
assignments to the unallocated last entry of the array.  On the new
i965 VS backend, that happened to land on the vertex position.

Some issues remain in this test on softpipe, i965/old-vs and
i965/new-vs on visual inspection, but i965 is passing because only one
green pixel is probed, not the whole split green/red quad.

13 years agoradeon: Explain to the user what went wrong when built without libdrm.
Eric Anholt [Wed, 3 Aug 2011 23:36:42 +0000 (16:36 -0700)]
radeon: Explain to the user what went wrong when built without libdrm.

Before this commit, even LIBGL_DEBUG=verbose would just fail with:
libGL error: failed to create dri screen

13 years agoglsl: Add validations for ir_call.
Paul Berry [Tue, 2 Aug 2011 22:44:39 +0000 (15:44 -0700)]
glsl: Add validations for ir_call.

This patch extends ir_validate.cpp to check the following
characteristics of each ir_call:

- The number of actual parameters must match the number of formal
  parameters in the signature.

- The type of each actual parameter must match the type of the
  corresponding formal parameter in the signature.

- Each "out" or "inout" actual parameter must be an lvalue.

Reviewed-by: Chad Versace <chad@chad-versace.us>
13 years agoglsl: Make is_lvalue() and variable_referenced() const.
Paul Berry [Tue, 2 Aug 2011 22:22:25 +0000 (15:22 -0700)]
glsl: Make is_lvalue() and variable_referenced() const.

These functions don't modify the target instruction, so it makes sense
to make them const.  This allows these functions to be called from ir
validation code (which uses const to ensure that it doesn't
accidentally modify the IR being validated).

Reviewed-by: Chad Versace <chad@chad-versace.us>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agoglsl: Perform implicit type conversions on function call out parameters.
Paul Berry [Tue, 2 Aug 2011 21:34:17 +0000 (14:34 -0700)]
glsl: Perform implicit type conversions on function call out parameters.

When an out parameter undergoes an implicit type conversion, we need
to store it in a temporary, and then after the call completes, convert
the resulting value.  In other words, we convert code like the
following:

void f(out int x);
float value;
f(value);

Into IR that's equivalent to this:

void f(out int x);
float value;
int out_parameter_conversion;
f(out_parameter_conversion);
value = float(out_parameter_conversion);

This transformation needs to happen during ast-to-IR convertion (as
opposed to, say, a lowering pass), because it is invalid IR for formal
and actual parameters to have types that don't match.

Fixes piglit tests
spec/glsl-1.20/compiler/qualifiers/out-conversion-int-to-float.vert and
spec/glsl-1.20/execution/qualifiers/vs-out-conversion-*.shader_test,
and bug 39651.

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

Reviewed-by: Chad Versace <chad@chad-versace.us>
13 years agodocs: Remove GLw from the documentation except for a new FAQ entry.
Kenneth Graunke [Fri, 5 Aug 2011 23:59:04 +0000 (16:59 -0700)]
docs: Remove GLw from the documentation except for a new FAQ entry.

Also remove an outdated reference to GLEW being in tree.

Reviewed-by: Brian Paul <brianp@vmware.com>
13 years agoglw: Remove GLw source.
Kenneth Graunke [Fri, 5 Aug 2011 23:39:56 +0000 (16:39 -0700)]
glw: Remove GLw source.

libGLw is an old OpenGL widget library with optional Motif support.
It almost never changes and very few people actually still care about
it, so we've decided to ship it separately.

The new home for libGLw is: git://git.freedesktop.org/mesa/glw/

Reviewed-by: Brian Paul <brianp@vmware.com>
13 years agoglsl: Modify strategy for accumulating conditions when lowering if-statements
Ian Romanick [Mon, 1 Aug 2011 21:13:10 +0000 (14:13 -0700)]
glsl: Modify strategy for accumulating conditions when lowering if-statements

Previously if-statements were lowered from inner-most to outer-most
(i.e., bottom-up).  All assignments within an if-statement would have
the condition of the if-statement appended to its existing condition.
As a result the assignments from a deeply nested if-statement would
have a very long and complex condition.

Several shaders in the OpenGL ES2 conformance test suite contain
non-constant array indexing that has been lowered by the shader
writer.  These tests usually look something like:

    if (i == 0) {
        value = array[0];
    } else if (i == 1) {
        value = array[1];
    } else ...

The IR for the last assignment ends up as:

    (assign (expression bool && (expression bool ! (var_ref if_to_cond_assign_condition) ) (expression bool && (expression bool ! (var_ref if_to_cond_assign_condition@20) ) (expression bool && (expression bool ! (var_ref if_to_cond_assign_condition@22) ) (expression bool && (expression bool ! (var_ref if_to_cond_assign_condition@24) ) (var_ref if_to_cond_assign_condition@26) ) ) ) )  (x) (var_ref value) (array_ref (var_ref array) (constant int (5)))

The Mesa IR that is generated from this is just as awesome as you
might expect.

Three changes are made to the way if-statements are lowered.

1. Two condition variables, if_to_cond_assign_then and
if_to_cond_assign_else, are created for each if-then-else structure.
The former contains the "positive" condition, and the later contains
the "negative" condtion.  This change was implemented in the previous
patch.

2. Each condition variable is added to a hash-table when it is created.

3. When lowering an if-statement, assignments to existing condtion
variables get the current condition anded.  This ensures that nested
condition variables are only set to true when the condition variable
for all outer if-statements is also true.

Changes #1 and #3 combine to ensure the correctness of the resulting
code.

4. When a condition assignment is encountered with a condition that is
a dereference of a previously added condition variable, the condition
is not modified.

Change #4 prevents the continuous accumulation of conditions on
assignments.

If the original if-statements were:

    if (x) {
        if (a && b && c && d && e) {
            ...
        } else {
            ...
        }
    } else {
        if (g && h && i && j && k) {
            ...
        } else {
            ...
        }
    }

The lowered code will be

    if_to_cond_assign_then@1 = x;
    if_to_cond_assign_then@2 = a && b && c && d && e
        && if_to_cond_assign_then@1;
    ...
    if_to_cond_assign_else@2 = !if_to_cond_assign_then
        && if_to_cond_assign_then@1;
    ...

    if_to_cond_assign_else@1 = !if_to_cond_assign_then@1;
    if_to_cond_assign_then@3 = g && h && i && j;
        && if_to_cond_assign_else@1;
    ...
    if_to_cond_assign_else@3 = !if_to_cond_assign_then
        && if_to_cond_assign_else@1;
    ...

Depending on how instructions are emitted, there may be an extra
instruction due to the duplication of the '&&
if_to_cond_assign_{then,else}@1' on the nested else conditions.  In
addition, this may cause some unnecessary register pressure since in
the simple case (where the nested conditions are not complex) the
nested then-condition variables are live longer than strictly
necessary.

Before this change, one of the shaders in the OpenGL ES2 conformance
test suite's acos_float_frag_xvary generated 348 Mesa IR instructions.
After this change it only generates 124.  Many, but not all, of these
instructions would have also been eliminated by CSE.

Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agoglsl: Slight change to the code generated by if-flattening
Ian Romanick [Mon, 1 Aug 2011 20:55:46 +0000 (13:55 -0700)]
glsl: Slight change to the code generated by if-flattening

Now the condition (for the then-clause) and the inverse condition (for
the else-clause) get written to separate temporary variables.  In the
presence of complex conditions, this shouldn't result in more code
being generated.  If the original if-statement was

    if (a && b && c && d && e) {
        ...
    } else {
        ...
    }

The lowered code will be

   if_to_cond_assign_then = a && b && c && d && e;
   ...
   if_to_cond_assign_else = !if_to_cond_assign_then;
   ...

Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agoglsl: Replace foreach_iter with foreach_list_safe
Ian Romanick [Mon, 1 Aug 2011 20:36:12 +0000 (13:36 -0700)]
glsl: Replace foreach_iter with foreach_list_safe

Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agoglsl: Make move_block_to_cond_assign not care which branch it's processing
Ian Romanick [Mon, 1 Aug 2011 20:28:11 +0000 (13:28 -0700)]
glsl: Make move_block_to_cond_assign not care which branch it's processing

This will make some future changes a bit easier to digest.

Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agoegl: Log (debug) native platform type
Benjamin Franzke [Tue, 9 Aug 2011 14:16:33 +0000 (16:16 +0200)]
egl: Log (debug) native platform type

Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
13 years agoegl: Native Display autodetection
Benjamin Franzke [Tue, 9 Aug 2011 12:23:18 +0000 (14:23 +0200)]
egl: Native Display autodetection

EGL doesnt define howto manage different native platforms.
So mesa has a builtime configurable default platform,
whith non-standard envvar (EGL_PLATFORM) overwrites.
This caused unneeded bugreports, when EGL_PLATFORM was forgotten.

Detection is grouped into basic types of NativeDisplays (which itself
needs to be detected).  The final decision is based on characteristcs
of these basic types:

  File Desciptor based platforms (fbdev):
    - fstat(2) to check for being a fd that belongs to a character device
    - check kernel subsystem (todo)

  Pointer to structuctures (x11, wayland, drm/gbm):
    - mincore(2) to check whether its valid pointer to some memory.
    - magic elements (e.g. pointers to exported symbols):
      o wayland display stores interface type pointer (first elm.)
      o gbm stores pointer to its constructor (first elm.)
      o x11 as a fallback (FIXME?)

Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
13 years agoDestroy context in dri2/glx driver when apps call eglDestroyContext
Cooper Yuan [Sun, 14 Aug 2011 07:14:17 +0000 (15:14 +0800)]
Destroy context in dri2/glx driver when apps call eglDestroyContext

13 years agoglapi: remove gen-es
Chia-I Wu [Sun, 7 Aug 2011 14:57:51 +0000 (23:57 +0900)]
glapi: remove gen-es

Not used anymore.

13 years agoglapi: generate ES dispatch headers from core mesa
Chia-I Wu [Thu, 11 Aug 2011 08:41:09 +0000 (16:41 +0800)]
glapi: generate ES dispatch headers from core mesa

GLESv1 and GLESv2 have their own dispatch.h and remap_helper.h.  These
headers are only used by api_exec_es1.c and api_exec_es2.c in core mesa.
Move the rules to generate them from glapi to core mesa.

Reviewed-by: Brian Paul <brianp@vmware.com>
[olv: updated after reviewing to fix SCons build]

13 years agoglapi: add glapi_gen.mk to help header generation
Chia-I Wu [Mon, 8 Aug 2011 01:40:12 +0000 (10:40 +0900)]
glapi: add glapi_gen.mk to help header generation

glapi_gen.mk is supposed to be included by glapi users to simplify
header generation.  This commit also makes es1api, es2api, and
shared-glapi use it.

Reviewed-by: Brian Paul <brianp@vmware.com>
[olv: updated after reviewing to prefix all variables in glapi_gen.mk by
 glapi_gen]

13 years agoglapi: use gl_and_es_API.xml to generate GLES headers
Chia-I Wu [Mon, 8 Aug 2011 01:14:44 +0000 (10:14 +0900)]
glapi: use gl_and_es_API.xml to generate GLES headers

glapi/gen-es/ defines two sets of GLAPI XMLs for OpenGL ES 1.1
(es1_API.xml) and 2.0 (es2_API.xml) respectively.  They are used to
generate dispatch.h and remap_helper.h for GLES.  Together with
gl_and_es_API.xml, we have to maintain three sets of GLAPI XMLs.

This commit makes dispatch.h and remap_helper.h for GLES be generated
from gl_and_es_API.xml.

Reviewed-by: Brian Paul <brianp@vmware.com>
13 years agoglapi: add methods to filter functions
Chia-I Wu [Sun, 7 Aug 2011 14:19:51 +0000 (23:19 +0900)]
glapi: add methods to filter functions

add gl_api::filter_functions and gl_function::filter_entry_points to
filter out unwanted functions and entry points.

Reviewed-by: Brian Paul <brianp@vmware.com>
13 years agoglapi: add gles_api.py
Chia-I Wu [Sun, 7 Aug 2011 07:58:29 +0000 (16:58 +0900)]
glapi: add gles_api.py

Move the list of entry points belong to GLES from mapi_abi.py to a new
file.

Until we figure out how to describe the APIs an entry point belongs to
in the XML file, and how to handle the case where an entry point others
alias is missing in some APIs, this is an easier solution than
maintaining another two sets of XMLs in glapi/gen-es/.

Reviewed-by: Brian Paul <brianp@vmware.com>
13 years agogallium/gbm: Add dependencies for libraries linked into pipe_*.so.
Michel Dänzer [Fri, 12 Aug 2011 09:10:56 +0000 (11:10 +0200)]
gallium/gbm: Add dependencies for libraries linked into pipe_*.so.

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
13 years agox86-64: Fix compile error with clang
Chad Versace [Wed, 10 Aug 2011 22:46:14 +0000 (15:46 -0700)]
x86-64: Fix compile error with clang

Remove the 'f' suffix from a float literal.
    - .float 0.0f+1.0
    + .float 1.0

This fixes the following compile error with clang:
    error: unexpected token in directive
    .float 0.0f+1.0
              ^

Note: This is a candidate for the stable branches.
Reviewed-by: Ben Widawsky <ben@bwidawsk.net>
Signed-off-by: Chad Versace <chad@chad-versace.us>
13 years agomesa: fix initialization of GL_FOG_MODE in _mesa_init_driver_state()
Brian Paul [Thu, 11 Aug 2011 15:02:16 +0000 (09:02 -0600)]
mesa: fix initialization of GL_FOG_MODE in _mesa_init_driver_state()