platform/upstream/mesa.git
13 years agomesa: only update array _MaxElement if array is enabled
Brian Paul [Wed, 18 May 2011 14:14:32 +0000 (08:14 -0600)]
mesa: only update array _MaxElement if array is enabled

Fixes failed assertion when calling _mesa_print_arrays() debug function.

13 years agomesa: check that flex/bison are installed
Brian Paul [Wed, 18 May 2011 13:50:21 +0000 (07:50 -0600)]
mesa: check that flex/bison are installed

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

NOTE: This is a candidate for the 7.10 branch.

13 years agoi965: Rename IS_GT1 and IS_GT2 to IS_SNB_GT1 and IS_SNB_GT2.
Kenneth Graunke [Wed, 18 May 2011 06:53:52 +0000 (23:53 -0700)]
i965: Rename IS_GT1 and IS_GT2 to IS_SNB_GT1 and IS_SNB_GT2.

This should help distinguish Sandybridge GT1/GT2 from Ivybridge GT1/GT2.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agoadd $SELINUX_LIBS to EGL and OpenVG lib deps
Tapani Pälli [Mon, 16 May 2011 13:56:43 +0000 (16:56 +0300)]
add $SELINUX_LIBS to EGL and OpenVG lib deps

Correctly links against selinux library when MESA is built with --enable-selinux option.

Fixes bug #36333 in Freedesktop bugzilla

Signed-off-by: Dave Airlie <airlied@redhat.com>
13 years agomesa/st: split updating vertex and fragment shader stages.
Dave Airlie [Wed, 18 May 2011 07:27:39 +0000 (17:27 +1000)]
mesa/st: split updating vertex and fragment shader stages.

this seems like a logical thing to do and sets the correct st flags
for vertex textures.

Signed-off-by: Dave Airlie <airlied@redhat.com>
13 years agost/mesa: only memset sampler when about to use it.
Dave Airlie [Sun, 15 May 2011 23:44:10 +0000 (09:44 +1000)]
st/mesa: only memset sampler when about to use it.

This function was taking a lot more CPU than required due to it memsetting
a bunch of memory that didn't require it from what I can see.

We should only memset here when we are about to fill out the sampler,
otherwise we end up doing a bunch of memsets for everytime this function
is called, basically setting 0 memory to 0.

Signed-off-by: Dave Airlie <airlied@redhat.com>
13 years agor600g: bump domain selection up one layer.
Dave Airlie [Fri, 13 May 2011 04:16:31 +0000 (14:16 +1000)]
r600g: bump domain selection up one layer.

this is taken from a patch from Mathias Froehlich, just going to
stage it in a few pieces.

Signed-off-by: Dave Airlie <airlied@redhat.com>
13 years agoi965: Instead of fallback on missing region, just bind a null renderbuffer.
Eric Anholt [Fri, 13 May 2011 04:05:30 +0000 (21:05 -0700)]
i965: Instead of fallback on missing region, just bind a null renderbuffer.

The change for GPU hanging in 13bab58f04c1ec6d0d52760eab490a0997d9abe2
fell back even when rb == NULL, which is wrong for GLES2 and caused
segfaulting in GLES2 conformance.  For the GPU hang case (where the
broken 2D driver failed to allocate a BO for the window system
renderbuffer), it also would assertion fail/segfault immediately after
the fallback setup when the renderbuffer map failed.

Fixes GLES2 conformance packed_depth_stencil.

Signed-off-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agoi965: Updated fixed-point sizes in Ivybridge SAMPLER_STATE.
Kenneth Graunke [Tue, 17 May 2011 19:53:55 +0000 (12:53 -0700)]
i965: Updated fixed-point sizes in Ivybridge SAMPLER_STATE.

Texture LOD Bias is now S4.8 instead of S4.6;
Min LOD, and Max LOD are now U4.8 instead of U4.6.

Fixes piglit test tex-miplevel-selection.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agoi965: Ivybridge uses the Gen4 SAMPLER_BORDER_COLOR_STATE.
Kenneth Graunke [Tue, 17 May 2011 21:17:21 +0000 (14:17 -0700)]
i965: Ivybridge uses the Gen4 SAMPLER_BORDER_COLOR_STATE.

Volume 5c 1.13.7 lists it as [PreDevILK] and [DevIVB+].

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agoegl: Recognize Ivybridge PCI IDs.
Kenneth Graunke [Tue, 26 Apr 2011 19:25:56 +0000 (12:25 -0700)]
egl: Recognize Ivybridge PCI IDs.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agointel: Recognize new Ivybridge PCI IDs.
Kenneth Graunke [Tue, 22 Mar 2011 23:45:52 +0000 (16:45 -0700)]
intel: Recognize new Ivybridge PCI IDs.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agoi965: Disable register spilling on Ivybridge for now.
Kenneth Graunke [Fri, 13 May 2011 16:25:27 +0000 (09:25 -0700)]
i965: Disable register spilling on Ivybridge for now.

The data port messages for this are rather different.  For now, fail to
compile rather than hanging the GPU.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agoi965: Fix RNDZ and RNDE on Sandybridge and Ivybridge.
Kenneth Graunke [Wed, 11 May 2011 09:18:24 +0000 (02:18 -0700)]
i965: Fix RNDZ and RNDE on Sandybridge and Ivybridge.

On gen4/5, the RNDZ and RNDE instructions return floor(x), but set special
"round increment bits" in the flag register; a predicated ADD (+1) fixes
the result.

The documentation still lists '.r' as existing, and says that the
predicated add is necessary, but it apparently lies.  According to the
simulator, BRW_CONDITIONAL_R (7) is not a valid conditional modifier
and the RNDZ and RNDE instructions simply produce the correct value.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agoi965: Fix data port reads on Ivybridge.
Kenneth Graunke [Wed, 11 May 2011 08:49:10 +0000 (01:49 -0700)]
i965: Fix data port reads on Ivybridge.

These also need to use gen7_dp.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agoi965: Avoid register coalescing away MATH workarounds on Ivybridge.
Kenneth Graunke [Wed, 11 May 2011 14:54:57 +0000 (07:54 -0700)]
i965: Avoid register coalescing away MATH workarounds on Ivybridge.

The MATH instruction cannot handle source modifiers, even on Gen7.
So, apply this workaround for Sandybridge on Ivybridge as well.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agoi965: Make the CONT instruction point to the WHILE instruction.
Kenneth Graunke [Sat, 30 Apr 2011 08:30:55 +0000 (01:30 -0700)]
i965: Make the CONT instruction point to the WHILE instruction.

This fixes piglit test glsl-fs-loop-continue.shader_test on Ivybridge.
According to the documentation, the CONT instruction's UIP field should
point to the WHILE instruction on both Sandybridge and Ivybridge.

The previous code made UIP point to the implicit DO instruction, which
seems incorrect.  I'm not sure how it could have worked on Sandybridge.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agoi965: Add support for loops on Ivybridge.
Kenneth Graunke [Sat, 30 Apr 2011 08:17:52 +0000 (01:17 -0700)]
i965: Add support for loops on Ivybridge.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agoi965: Add support for IF/ELSE/ENDIF control flow on Ivybridge.
Kenneth Graunke [Wed, 16 Mar 2011 06:53:40 +0000 (23:53 -0700)]
i965: Add support for IF/ELSE/ENDIF control flow on Ivybridge.

Ivybridge's IF instruction doesn't support conditional modifiers.
It also introduces UIP, which must point to the ENDIF instruction.

ELSE and ENDIF remain the same except that JIP moves from dst to src1.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agoi965: Add support for Ivybridge texturing messages.
Kenneth Graunke [Fri, 29 Apr 2011 21:19:04 +0000 (14:19 -0700)]
i965: Add support for Ivybridge texturing messages.

Ivybridge puts the shadow comparator first, then lod/bias, and finally
the coordinate---unlike previous generations which always reserved four
slots for the coordinate at the beginning.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agoi965: Fix sampler message descriptor on Ivybridge.
Kenneth Graunke [Fri, 29 Apr 2011 08:43:10 +0000 (01:43 -0700)]
i965: Fix sampler message descriptor on Ivybridge.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agoi965: Fix SAMPLER_STATE on Ivybridge.
Kenneth Graunke [Fri, 29 Apr 2011 05:46:15 +0000 (22:46 -0700)]
i965: Fix SAMPLER_STATE on Ivybridge.

Most of this code copied from brw_wm_sampler_state.c.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agoi965: Mark some brw_wm_sampler_state.c helper functions as non-static.
Kenneth Graunke [Fri, 29 Apr 2011 08:18:20 +0000 (01:18 -0700)]
i965: Mark some brw_wm_sampler_state.c helper functions as non-static.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agoi965: Update SURFACE_STATE for Ivybridge.
Kenneth Graunke [Thu, 28 Apr 2011 01:12:20 +0000 (18:12 -0700)]
i965: Update SURFACE_STATE for Ivybridge.

I'm still not happy with the amount of code duplication here, but it
will have to do for now.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agoi965: Mark a few more brw_wm_surface_state functions as non-static.
Kenneth Graunke [Thu, 28 Apr 2011 01:11:31 +0000 (18:11 -0700)]
i965: Mark a few more brw_wm_surface_state functions as non-static.

I need to reuse them.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agoi965: Change brw_format_for_mesa_format to a non-static function.
Kenneth Graunke [Thu, 28 Apr 2011 01:03:49 +0000 (18:03 -0700)]
i965: Change brw_format_for_mesa_format to a non-static function.

This will make it easier to share between files.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agoi965: Set Address Modify Enable in VERTEX_BUFFER on Ivybridge.
Kenneth Graunke [Tue, 19 Apr 2011 22:38:10 +0000 (15:38 -0700)]
i965: Set Address Modify Enable in VERTEX_BUFFER on Ivybridge.

Otherwise, Ivybridge seems to ignore the newly supplied data, giving us
rubbish for vertices.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agoi965: Enable channel masks in Ivybridge's URB_WRITE_HWORD header.
Kenneth Graunke [Wed, 27 Apr 2011 00:24:38 +0000 (17:24 -0700)]
i965: Enable channel masks in Ivybridge's URB_WRITE_HWORD header.

This shouldn't be done using MRFs, but until I have a proper solution
for dealing with MRFs, this allows my hack to keep working.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agoi965: Fix the URB write message descriptor on Ivybridge.
Kenneth Graunke [Tue, 19 Apr 2011 06:59:30 +0000 (23:59 -0700)]
i965: Fix the URB write message descriptor on Ivybridge.

The message header is still incorrect, but this is a start.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agoi965: Fix render target writes on Ivybridge.
Kenneth Graunke [Tue, 19 Apr 2011 06:38:21 +0000 (23:38 -0700)]
i965: Fix render target writes on Ivybridge.

Ivybridge shifts the data port messages by one bit.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agoi965: Mad hacks to avoid using MRFs on Ivybridge.
Kenneth Graunke [Sat, 9 Apr 2011 07:32:46 +0000 (00:32 -0700)]
i965: Mad hacks to avoid using MRFs on Ivybridge.

Ivybridge's SEND instruction uses GRFs instead of MRFs.  Unfortunately,
a lot of our code explicitly uses MRFs, and rewriting it would take a
fair bit of effort.  In the meantime, use a hack:

- Change brw_set_dest, brw_set_src0, and brw_set_src1 to implicitly
  convert any MRFs into the top 16 GRFs.
- Enable gen6_resolve_implied_move on Ivybridge: Moving g0 to m0
  actually moves it to g111 thanks to the previous hack.

It remains to officially reserve these registers so the allocator
doesn't try to reuse them.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agoi965: Emit 3DPRIMITIVE Ivybridge-style.
Kenneth Graunke [Tue, 12 Apr 2011 18:51:36 +0000 (11:51 -0700)]
i965: Emit 3DPRIMITIVE Ivybridge-style.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agoi965: Don't use the GS for breaking down quads on Ivybridge.
Kenneth Graunke [Thu, 14 Apr 2011 21:56:19 +0000 (14:56 -0700)]
i965: Don't use the GS for breaking down quads on Ivybridge.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agoi965: Emit extra 0's in 3DSTATE_MULTISAMPLE on Ivybridge.
Kenneth Graunke [Sat, 9 Apr 2011 07:53:46 +0000 (00:53 -0700)]
i965: Emit extra 0's in 3DSTATE_MULTISAMPLE on Ivybridge.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agoi965: Add depth buffer support on Ivybridge.
Kenneth Graunke [Sat, 9 Apr 2011 06:51:21 +0000 (23:51 -0700)]
i965: Add depth buffer support on Ivybridge.

This also disables the HiZ and separate stencil buffers.  We still need
to implement stencil.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agoi965: Upload sampler state pointers on Ivybridge.
Kenneth Graunke [Wed, 9 Feb 2011 01:27:37 +0000 (17:27 -0800)]
i965: Upload sampler state pointers on Ivybridge.

Since we currently only support sampling in the fragment shader, we only
bother to emit the PS variant.  In the future we'll need to emit others.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agoi965: Disable binding table pointers for unused pipeline stages.
Kenneth Graunke [Thu, 21 Apr 2011 01:23:38 +0000 (18:23 -0700)]
i965: Disable binding table pointers for unused pipeline stages.

This may not be necessary, but it seems like a good idea.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agoi965: Upload binding table pointers on Ivybridge.
Kenneth Graunke [Tue, 22 Feb 2011 21:30:34 +0000 (13:30 -0800)]
i965: Upload binding table pointers on Ivybridge.

Ivybridge uses per-stage commands to update binding table pointers.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agoi965: Split BRW_NEW_BINDING_TABLE dirty bit into one per stage.
Kenneth Graunke [Tue, 22 Feb 2011 21:30:02 +0000 (13:30 -0800)]
i965: Split BRW_NEW_BINDING_TABLE dirty bit into one per stage.

Ivybridge can update each stage's binding table pointer independently,
so we want separate dirty bits.  Previous generations can simply
subscribe to all three dirty bits and emit as usual.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agoi965: Explicitly disable unused pipeline stages on Ivybridge.
Kenneth Graunke [Sat, 9 Apr 2011 09:30:34 +0000 (02:30 -0700)]
i965: Explicitly disable unused pipeline stages on Ivybridge.

This may not be strictly necessary, but seems wise.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agoi965: Initial Ivybridge VS state.
Kenneth Graunke [Sat, 9 Apr 2011 08:16:06 +0000 (01:16 -0700)]
i965: Initial Ivybridge VS state.

Copied from gen6_vs_state.c; reuses create_vs_constant_bo from there.

The 3DSTATE_VS command is identical but 3DSTATE_CONSTANT_VS is not.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agoi965: Initial Ivybridge Viewport state setup.
Kenneth Graunke [Wed, 9 Feb 2011 08:49:59 +0000 (00:49 -0800)]
i965: Initial Ivybridge Viewport state setup.

SF and CLIP viewport state has been combined into SF_CLIP_VIEWPORT;
SF_CLIP and CC state pointers can now be uploaded independently.

Some portions of the hardware documentation refer to separate upload
commands for SF and CLIP; these are outdated and incorrect.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agoi965: Initial Ivybridge Clip state setup.
Kenneth Graunke [Mon, 28 Mar 2011 20:12:21 +0000 (13:12 -0700)]
i965: Initial Ivybridge Clip state setup.

Copied from gen6_clip_state.c.

This enables early culling and sets the necessary fields.  Otherwise, it
is entirely the same, so I doubt this patch is strictly necessary for a
functional driver.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agoi965: Initial Ivybridge CC state setup.
Kenneth Graunke [Wed, 9 Feb 2011 09:05:40 +0000 (01:05 -0800)]
i965: Initial Ivybridge CC state setup.

The state itself still seems to be the same; the only change is that
each part (CC, BLEND, DEPTH_STENCIL) can now be uploaded independently.
Thus, we still rely on the code in gen6_cc.c to set up the state.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agoi965: Initial Ivybridge WM/PS state setup.
Kenneth Graunke [Thu, 3 Feb 2011 00:00:08 +0000 (16:00 -0800)]
i965: Initial Ivybridge WM/PS state setup.

Copied from gen6_wm_state.c.

The main change from Sandybridge seems to be that 3DSTATE_WM was split
into two separate state packet commands: 3DSTATE_WM and 3DSTATE_PS.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agoi965: Initial Ivybridge SF/SBE state setup.
Kenneth Graunke [Wed, 5 Jan 2011 09:21:06 +0000 (01:21 -0800)]
i965: Initial Ivybridge SF/SBE state setup.

Copied from gen6_sf_state.c.

The main change from Sandybridge seems to be that 3DSTATE_SF was split
into two separate state packet commands: 3DSTATE_SF and 3DSTATE_SBE
("setup backend").  The bit-offsets are even the same - only the DWords
numbers have shuffled around a bit.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agoi965: Make gen6_sf_state.c's get_attr_override non-static.
Kenneth Graunke [Fri, 29 Apr 2011 07:29:02 +0000 (00:29 -0700)]
i965: Make gen6_sf_state.c's get_attr_override non-static.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agoi965: Initial Ivybridge URB space partitioning, including push constants.
Kenneth Graunke [Sun, 27 Mar 2011 08:18:41 +0000 (01:18 -0700)]
i965: Initial Ivybridge URB space partitioning, including push constants.

Currently this always reserves 16kB for push constants, regardless of
how much space is needed, and partitions it evenly betwen the VS and FS.
This is probably not ideal, but is straightforward.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agoi965: Set maximum number of threads for Ivybridge.
Kenneth Graunke [Sat, 9 Apr 2011 08:57:31 +0000 (01:57 -0700)]
i965: Set maximum number of threads for Ivybridge.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agoi965: Split out tracked state atoms for Ivybridge.
Kenneth Graunke [Thu, 3 Feb 2011 19:10:23 +0000 (11:10 -0800)]
i965: Split out tracked state atoms for Ivybridge.

Currently, gen7_atoms is a verbatim copy of gen6_atoms; future commits
will update it to contain gen7-specific state.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agointel: Initial IS_GEN7 plumbing.
Kenneth Graunke [Mon, 16 May 2011 22:19:22 +0000 (15:19 -0700)]
intel: Initial IS_GEN7 plumbing.

Currently, IS_GEN7, IS_IVYBRIDGE, IS_IVB_GT1, and IS_IVB_GT2 all return
false.  This allows me to write the code for them before actually adding
the PCI IDs and thus enabling the hardware.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agoi965: Rename max_vs_handles to max_vs_entries for consistency.
Kenneth Graunke [Sun, 15 May 2011 06:42:46 +0000 (23:42 -0700)]
i965: Rename max_vs_handles to max_vs_entries for consistency.

The documentation uses the term "vertex URB entries", the code talks
about "entry size", and so on.  Also, handles are just "pointers" to
entries (actually small integers).

Also rename max_gs_handles to max_gs_entries.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agoi965: Convert BRW_NEW_* dirty bits to use an enum.
Kenneth Graunke [Mon, 16 May 2011 21:17:15 +0000 (14:17 -0700)]
i965: Convert BRW_NEW_* dirty bits to use an enum.

This will make it much easier to add new dirty bits.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Chad Versace <chad.versace@intel.com>
13 years agoi965: Rework IF/ELSE jump target back-patching.
Kenneth Graunke [Mon, 16 May 2011 20:40:00 +0000 (13:40 -0700)]
i965: Rework IF/ELSE jump target back-patching.

The primary motivation for this is to better support Ivybridge control
flow.  Ivybridge IF instructions need to point to the first instruction
of the ELSE block -and- the ENDIF instruction; the existing code only
supported back-patching one instruction ago.

A second goal is to simplify and centralize the back-patching, hopefully
clarifying the code somewhat.

Previously, brw_ELSE back-patched the IF instruction, and brw_ENDIF
back-patched the previous instruction (IF or ELSE).  With this patch,
brw_ENDIF is responsible for patching both the IF and (optional) ELSE.

To support this, the control flow stack (if_stack) maintains pointers to
both the IF and ELSE instructions.  Unfortunately, in single program
flow (SPF) mode, both were emitted as ADD instructions, and thus
indistinguishable.

To remedy this, this patch simply emits IF and ELSE, rather than ADDs;
brw_ENDIF will convert them to ADDs (the SPF version of back-patching).

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agoi965: Move IF stack handling into the EU abstraction layer/brw_compile.
Kenneth Graunke [Mon, 16 May 2011 19:25:18 +0000 (12:25 -0700)]
i965: Move IF stack handling into the EU abstraction layer/brw_compile.

This hides the IF stack and back-patching of IF/ELSE instructions from
each of the code generators, greatly simplifying the interface.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agoi965: Get a ralloc context into brw_compile.
Kenneth Graunke [Mon, 16 May 2011 18:49:57 +0000 (11:49 -0700)]
i965: Get a ralloc context into brw_compile.

This would be so much easier if we were using C++; we could simply use
constructors and destructors.  Instead, we have to update all the
callers.

While we're at it, ralloc various brw_wm_compile fields rather than
explicitly calloc/free'ing them.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agoi965/gs: Move generation check for bailing earlier.
Kenneth Graunke [Mon, 16 May 2011 18:41:32 +0000 (11:41 -0700)]
i965/gs: Move generation check for bailing earlier.

On Sandybridge, we don't need to break down primitives.  There's no need
to bother setting up brw_compile and such if it's not going to be used;
bail as early as possible.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agoi965: Add _NEW_LIGHT to Gen6 clip state dirty bits.
Kenneth Graunke [Tue, 17 May 2011 05:00:17 +0000 (22:00 -0700)]
i965: Add _NEW_LIGHT to Gen6 clip state dirty bits.

ctx->Light.ProvokingVertex depends on _NEW_LIGHT.

Found by inspection.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agomesa: add some missing GLAPIENTRY keywords
Brian Paul [Wed, 18 May 2011 03:24:05 +0000 (21:24 -0600)]
mesa: add some missing GLAPIENTRY keywords

NOTE: this is a candidate for the 7.10 branch.

13 years agor300/compiler: Fix bug in rc_get_variables()
Tom Stellard [Wed, 18 May 2011 01:51:20 +0000 (18:51 -0700)]
r300/compiler: Fix bug in rc_get_variables()

Variables that write to the same source select need to pe paired
together otherwise the register allocator might fail.

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

13 years agou_vbuf_mgr: fix max_index computation when src_offset is abused as buffer_offset
Marek Olšák [Mon, 16 May 2011 23:16:27 +0000 (01:16 +0200)]
u_vbuf_mgr: fix max_index computation when src_offset is abused as buffer_offset

13 years agomesa: make RGB9_E5 non-renderable on swrast again
Marek Olšák [Sat, 14 May 2011 02:42:29 +0000 (04:42 +0200)]
mesa: make RGB9_E5 non-renderable on swrast again

_BaseFormat for RGB9_E5 is GL_RGBA due to the previous revert.

13 years agoRevert "mesa: set reasonable defaults in update_wrapper"
Marek Olšák [Sat, 14 May 2011 02:38:36 +0000 (04:38 +0200)]
Revert "mesa: set reasonable defaults in update_wrapper"

This reverts commit 1d5f16ff8fae936f2e920800b169cf7736a8052a.

It breaks fbo-readpixels on swrast.
For some reason, swrast likes GL_RGBA and CHAN_TYPE.

13 years agoi965: Pass brw_compile pointer to brw_set_src[01].
Kenneth Graunke [Tue, 10 May 2011 23:51:12 +0000 (16:51 -0700)]
i965: Pass brw_compile pointer to brw_set_src[01].

This makes it symmetric with brw_set_dest, which is convenient, and will
also allow for assertions to be made based off of intel->gen.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agoi965: Fix "Paramater" typo in gen6_wm_state.c.
Kenneth Graunke [Sun, 15 May 2011 07:21:45 +0000 (00:21 -0700)]
i965: Fix "Paramater" typo in gen6_wm_state.c.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agoegl: Compile wayland-drm.a into libEGL independent of egl_dri2
Benjamin Franzke [Mon, 16 May 2011 08:36:36 +0000 (10:36 +0200)]
egl: Compile wayland-drm.a into libEGL independent of egl_dri2

Fixes egl_gallium when egl_dri2 is not enabled.

13 years agost/mesa: overhaul vertex/fragment sampler and sampler views.
Dave Airlie [Sat, 14 May 2011 08:04:08 +0000 (18:04 +1000)]
st/mesa: overhaul vertex/fragment sampler and sampler views.

This fixes piglits fragment-and-vertex-texturing test on llvmpipe for me.

I've no idea if someone had another plan for this that is smarter than what
I've done here, but what I've basically done is

split fragment and vertex sampler and sampler_view setup function, factor
out the common chunks of both.

side-cleanups:
drop st->state.sampler_list - unused
don't update border color if we have no border color.

should fix https://bugs.freedesktop.org/show_bug.cgi?id=35849

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
13 years agogallium: block signals for new thread when spawning threads
Dave Airlie [Sun, 15 May 2011 06:41:54 +0000 (16:41 +1000)]
gallium: block signals for new thread when spawning threads

I'm hard pressed to think of any reason a gallium thread would want to
receive a signal, especially considering its probably loaded as a library
and you don't want the threads interfering with the main threads signal
handling.

This solves a problem loading llvmpipe into the X server for AIGLX,
where the X server relies on the SIGIO signal going to the main thread,
but once llvmpipe loads the SIGIO can end up in any of its threads.

Signed-off-by: Dave Airlie <airlied@redhat.com>
13 years agor600g: reduce flushes so only when texture and CB overlap.
Dave Airlie [Fri, 13 May 2011 00:41:16 +0000 (10:41 +1000)]
r600g: reduce flushes so only when texture and CB overlap.

We only need to do this when the texture and CB are using the
same memory area.

Signed-off-by: Dave Airlie <airlied@redhat.com>
13 years agor300/compiler: Use ALU Result for IF conditionals
Tom Stellard [Sun, 15 May 2011 04:47:26 +0000 (21:47 -0700)]
r300/compiler: Use ALU Result for IF conditionals

This saves one instruction per IF.

13 years agor300g: HiZ fixes
Marek Olšák [Sat, 14 May 2011 05:47:37 +0000 (07:47 +0200)]
r300g: HiZ fixes

Nothing special, just changing conditions for when HiZ can be enabled and
when HiZ memory becomes invalid.

I was thinking about it again and realized it had not been quite right.

13 years agor300g: don't set other HyperZ states if depth and stencil tests are disabled
Marek Olšák [Sat, 14 May 2011 03:58:35 +0000 (05:58 +0200)]
r300g: don't set other HyperZ states if depth and stencil tests are disabled

Such as HiZ.

13 years agor300g: dynamically ask for and release Hyper-Z access
Marek Olšák [Sat, 7 May 2011 17:55:45 +0000 (19:55 +0200)]
r300g: dynamically ask for and release Hyper-Z access

We ask for Hyper-Z access when clearing a zbuffer.
We release it if no zbuffer clear has been done for 2 seconds.

13 years agor300g: fix conversion from int to boolean
Marek Olšák [Sun, 15 May 2011 00:10:44 +0000 (02:10 +0200)]
r300g: fix conversion from int to boolean

13 years agou_vbuf_mgr: fix max_index computation once again
Marek Olšák [Sat, 14 May 2011 17:25:55 +0000 (19:25 +0200)]
u_vbuf_mgr: fix max_index computation once again

See how I compute and use the 'unused' variable in the code.
It's crucial for getting max_index right.

Fixed with the help of apitrace.
(bisecting the problematic draw call manually was not fun though)

This should fix:
https://bugs.freedesktop.org/show_bug.cgi?id=36268
https://bugs.freedesktop.org/show_bug.cgi?id=36609

13 years agost/mesa: set correct baseInternalFormat for _mesa_texstore in DrawPixels
Marek Olšák [Fri, 13 May 2011 22:54:44 +0000 (00:54 +0200)]
st/mesa: set correct baseInternalFormat for _mesa_texstore in DrawPixels

GL_RGBA was always used for baseInternalFormat regardless of the chosen
texture internal format.

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

Reviewed-by: Brian Paul <brianp@vmware.com>
13 years agoi965: Use BRW_DATAPORT_READ_TARGET_DATA_CACHE instead of 0.
Kenneth Graunke [Fri, 13 May 2011 16:04:09 +0000 (09:04 -0700)]
i965: Use BRW_DATAPORT_READ_TARGET_DATA_CACHE instead of 0.

Using the #define'd constant is better than 0 with a comment.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Chad Versace <chad.versace@intel.com>
13 years agoi965: Rename dp_render_target struct to gen6_dp.
Kenneth Graunke [Fri, 13 May 2011 15:33:15 +0000 (08:33 -0700)]
i965: Rename dp_render_target struct to gen6_dp.

This is actually just the message descriptor for Gen6+ dataport access;
it has nothing to do with the render cache.  Access to the sampler cache
and constant cache also would use this struct; rename for clarity.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agoi965: Attempt to un-muddle Gen6 data port message target defines.
Kenneth Graunke [Fri, 13 May 2011 14:49:27 +0000 (07:49 -0700)]
i965: Attempt to un-muddle Gen6 data port message target defines.

These are documented on page 245 of IHD_OS_Vol4_Part2.pdf (the public
Sandybridge documentation/SEND instruction description).

Somebody had the bright idea to reuse gen4/5 defines labelled READ/WRITE
which just happened to be the same values as Render Cache/Sampler Cache.
It turns out that this field has nothing to do with READ/WRITE on
Sandybridge, but rather represents which data port to direct it to.

This was especially confusing in brw_set_dp_read_message, which
used "BRW_MESSAGE_TARGET_DATAPORT_WRITE."  In a read function.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agonvc0: prevent overlap between load address and destination regs
Christoph Bumiller [Fri, 13 May 2011 16:43:06 +0000 (18:43 +0200)]
nvc0: prevent overlap between load address and destination regs

For example, an indirect load like "ld b128 $r0q c0[$r0]" seems to
overwrite the address register before finishing the load, but only
if there are a lot of threads running.

Visible as displaced geoemtry in Unigine Heaven.

13 years agodocs: update relnotes-7.11
Marek Olšák [Fri, 13 May 2011 16:09:41 +0000 (18:09 +0200)]
docs: update relnotes-7.11

13 years agost/mesa: expose ARB_shader_texture_lod if SM3 is supported
Marek Olšák [Fri, 6 May 2011 19:59:23 +0000 (21:59 +0200)]
st/mesa: expose ARB_shader_texture_lod if SM3 is supported

Reviewed-by: Brian Paul <brianp@vmware.com>
13 years agoutil_logbase2 takes and returns unsigned, not int
Matt Turner [Mon, 9 May 2011 04:17:02 +0000 (00:17 -0400)]
util_logbase2 takes and returns unsigned, not int

Signed-off-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Brian Paul <brianp@vmware.com>
13 years agoRemove redundant util_unsigned_logbase2
Matt Turner [Mon, 9 May 2011 04:17:01 +0000 (00:17 -0400)]
Remove redundant util_unsigned_logbase2

util_logbase2 is exactly the same function.

Signed-off-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Brian Paul <brianp@vmware.com>
13 years agou_math.h: Remove redundant mingw32 ffs definition
Matt Turner [Mon, 9 May 2011 04:17:00 +0000 (00:17 -0400)]
u_math.h: Remove redundant mingw32 ffs definition

Signed-off-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Brian Paul <brianp@vmware.com>
13 years agost/egl: Implement EGL_WL_bind_wayland_display for x11,drm,wayland
Benjamin Franzke [Sat, 30 Apr 2011 09:18:23 +0000 (11:18 +0200)]
st/egl: Implement EGL_WL_bind_wayland_display for x11,drm,wayland

13 years agoegl_dri2: Discard similar configs
Benjamin Franzke [Thu, 12 May 2011 17:30:05 +0000 (19:30 +0200)]
egl_dri2: Discard similar configs

13 years agoegl_dri2: Make it possible to not compile in the X11 platform
Kristian Høgsberg [Wed, 11 May 2011 17:58:37 +0000 (13:58 -0400)]
egl_dri2: Make it possible to not compile in the X11 platform

13 years agonvfx: fill some PIPE_CAPs
Francesco Marella [Thu, 12 May 2011 11:27:09 +0000 (13:27 +0200)]
nvfx: fill some PIPE_CAPs

Signed-off-by: Francesco Marella <francesco.marella@gmail.com>
13 years agoi965: Fix incorrectly named data port define.
Kenneth Graunke [Fri, 13 May 2011 15:24:58 +0000 (08:24 -0700)]
i965: Fix incorrectly named data port define.

According to my documentation this is actually "Media Block Write" on
Gen4-5; there has never been a "DWord Block Write."

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agoi965: Fix typo in Gen6 "DWord Scattered Write" message define.
Kenneth Graunke [Fri, 13 May 2011 15:20:01 +0000 (08:20 -0700)]
i965: Fix typo in Gen6 "DWord Scattered Write" message define.

It's DWORD, not DWORLD.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agoi915g: Fix typos in print messages.
Vinson Lee [Fri, 13 May 2011 06:21:36 +0000 (23:21 -0700)]
i915g: Fix typos in print messages.

13 years agor600g: don't unmap if we haven't mapped
Dave Airlie [Fri, 13 May 2011 04:03:47 +0000 (14:03 +1000)]
r600g: don't unmap if we haven't mapped

should fix https://bugs.freedesktop.org/show_bug.cgi?id=37157

Signed-off-by: Dave Airlie <airlied@redhat.com>
13 years agomesa: EXT_texture_sRGB_decode little fixup
Marek Olšák [Thu, 12 May 2011 23:15:53 +0000 (01:15 +0200)]
mesa: EXT_texture_sRGB_decode little fixup

It doesn't fix bug 37150 though.

13 years agor600g: use a local var to store pointer to which register we are working on
Dave Airlie [Thu, 12 May 2011 05:24:35 +0000 (15:24 +1000)]
r600g: use a local var to store pointer to which register we are working on

this just makes the code a little bit cleaner.

Signed-off-by: Dave Airlie <airlied@redhat.com>
13 years agor600g: make range/block act more like a page table
Dave Airlie [Thu, 12 May 2011 05:01:33 +0000 (15:01 +1000)]
r600g: make range/block act more like a page table

only allocate the blocks ptr in the range if we ever have one,
otherwise don't bother wasting the memory.

valgrind glxinfo
before:
==967==     in use at exit: 419,754 bytes in 706 blocks
==967==   total heap usage: 3,552 allocs, 2,846 frees, 3,550,131 bytes allocated

after:
==5227==     in use at exit: 419,754 bytes in 706 blocks
==5227==   total heap usage: 3,452 allocs, 2,746 frees, 3,140,531 bytes allocate

Signed-off-by: Dave Airlie <airlied@redhat.com>
13 years agor600g: reduce r600_reg footprint
Dave Airlie [Thu, 12 May 2011 04:07:53 +0000 (14:07 +1000)]
r600g: reduce r600_reg footprint

This drops 6k of the text segment, a minor drop in the ocean, however
it also makes the code a lot cleaner and removes a lot of duplicated
information, hopefully making it more maintainable.

Signed-off-by: Dave Airlie <airlied@redhat.com>
13 years agor600g: reduce memory usage from range/block hash table.
Dave Airlie [Thu, 12 May 2011 03:20:02 +0000 (13:20 +1000)]
r600g: reduce memory usage from range/block hash table.

This table covered a large range unnecessarily, reduce the address
range covered, use the fact that the bottom two bits aren't significant,
and remove unused fields from the range struct. It also drops the hash_size/shift in context in favour of a define, which should make doing the math
a bit less CPU intensive.

valgrind glxinfo
Before:
==320==     in use at exit: 419,754 bytes in 706 blocks
==320==   total heap usage: 3,691 allocs, 2,985 frees, 7,272,467 bytes allocated

After:
==967==     in use at exit: 419,754 bytes in 706 blocks
==967==   total heap usage: 3,552 allocs, 2,846 frees, 3,550,131 bytes allocated

Signed-off-by: Dave Airlie <airlied@redhat.com>
13 years agor600g: delay mapping until first map request. (v2)
Dave Airlie [Wed, 11 May 2011 03:14:16 +0000 (13:14 +1000)]
r600g: delay mapping until first map request. (v2)

Currently r600g always maps every bo, this is quite pointless as it wastes
VM and on 32-bit with wine running VM space is quite useful.

So with this patch we don't create the mappings until first use, without
tiling enabled this probably won't make a major difference on its own,
but with tiled staged uploads it should avoid keeping maps for most of the
textures unnecessarily.

v2: add bo data ptr check

Signed-off-by: Dave Airlie <airlied@redhat.com>
13 years agoegl/dri2: Avoid unused static functions.
José Fonseca [Thu, 12 May 2011 14:24:26 +0000 (15:24 +0100)]
egl/dri2: Avoid unused static functions.