mesa.git
11 years agoi965/gen7: Enable support for fast color clears.
Paul Berry [Tue, 21 May 2013 18:58:38 +0000 (11:58 -0700)]
i965/gen7: Enable support for fast color clears.

This patch adds code to place mcs_state into INTEL_MCS_STATE_RESOLVED
for miptrees that are capable of supporting fast color clears.  This
will have no effect on buffers that don't undergo a fast color clear;
however, for buffers that do undergo a fast color clear, an MCS
miptree will be allocated (at the time of the first fast clear), and
will be used thereafter.

Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agoi965/gen7+: Disable fast color clears on shared regions.
Paul Berry [Tue, 21 May 2013 21:21:44 +0000 (14:21 -0700)]
i965/gen7+: Disable fast color clears on shared regions.

In certain circumstances the memory region underlying a miptree is
shared with other miptrees, or with other code outside Mesa's control.
This happens, for instance, when an extension like GL_OES_EGL_image or
GLX_EXT_texture_from_pixmap extension is used to associate a miptree
with an image existing outside of Mesa.

When this happens, we need to disable fast color clears on the miptree
in question, since there's no good synchronization mechanism to ensure
that deferred clear writes get performed by the time the buffer is
examined from the other miptree, or from outside of Mesa.

Fortunately, this should not be a performance hit for most
applications, since most applications that use these extensions use
them for importing textures into Mesa, rather than for exporting
rendered images out of Mesa.  So most of the time the miptrees
involved will never experience a clear.

v2: Rework based on the fact that we have decided not to use an
accessor function to protect access to the region.

Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agoi965/gen7+: Resolve color buffers when necessary.
Paul Berry [Tue, 7 May 2013 21:55:42 +0000 (14:55 -0700)]
i965/gen7+: Resolve color buffers when necessary.

Resolve color buffers that have been fast-color cleared:
    1. before texturing from the buffer (brw_predraw_resolve_buffers())
    2. before using the buffer as the source in a blorp blit
       (brw_blorp_blit_miptrees())
    3. before mapping the buffer's miptree (intel_miptree_map_raw(),
       intel_texsubimage_tiled_memcpy())
    4. before accessing the buffer using the hardware blitter
       (intel_miptree_blit(), do_blit_bitmap())

v2: Rework based on the fact that we have decided not to use an
accessor function to protect access to the region.

Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agoi965/gen7+: Ensure that front/back buffers are fast-clear resolved.
Paul Berry [Tue, 7 May 2013 22:38:45 +0000 (15:38 -0700)]
i965/gen7+: Ensure that front/back buffers are fast-clear resolved.

We already had code in intel_downsample_for_dri2_flush() for
downsampling front and back buffers when multisampling was in use.
This patch extends that function to perform fast color clear resolves
when necessary.

To account for the additional functionality, the function is renamed
to simply intel_resolve_for_dri2_flush().

Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agoi965/blorp: Write blorp code to do render target resolves.
Paul Berry [Mon, 6 May 2013 17:37:04 +0000 (10:37 -0700)]
i965/blorp: Write blorp code to do render target resolves.

This patch implements the "render target resolve" blorp operation.
This will be needed when a buffer that has experienced a fast color
clear is later used for a purpose other than as a render target
(texturing, glReadPixels, or swapped to the screen).  It resolves any
remaining deferred clear operation that was not taken care of during
normal rendering.

Fortunately not much work is necessary; all we need to do is scale
down the size of the rectangle primitive being emitted, run the
fragment shader with the "Render Target Resolve Enable" bit set, and
ensure that the fragment shader writes to the render target using the
"replicated color" message.  We already have a fragment shader that
does that (the shader that we use for fast color clears), so for
simplicity we re-use it.

Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agoi965/blorp: Expand clear class hierarchy to prepare for RT resolves.
Paul Berry [Mon, 6 May 2013 16:38:42 +0000 (09:38 -0700)]
i965/blorp: Expand clear class hierarchy to prepare for RT resolves.

The fragment shaders that to do color clears will be re-used to
perform so-called "render target resolves" (the resolves associated
with fast color clears).  To prepare for that, this patch expands the
class hierarchy for blorp params by adding
brw_blorp_const_color_params (which will be used for all blorp
operations where the fragment shader outputs a constant color).

Some other data structures and functions were also renamed to use
"const_color" nomenclature where appropriate.

Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agoi965/gen7+: Implement fast color clear operation in BLORP.
Paul Berry [Wed, 1 May 2013 15:04:12 +0000 (08:04 -0700)]
i965/gen7+: Implement fast color clear operation in BLORP.

Since we defer allocation of the MCS miptree until the time of the
fast clear operation, this patch also implements creation of the MCS
miptree.

In addition, this patch adds the field
intel_mipmap_tree::fast_clear_color_value, which holds the most recent
fast color clear value, if any. We use it to set the SURFACE_STATE's
clear color for render targets.

v2: Flag BRW_NEW_SURFACES when allocating the MCS miptree.  Generate a
perf_debug message if clearing to a color that isn't compatible with
fast color clear.  Fix "control reaches end of non-void function"
build warning.

Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agoi965/gen7+: Create helper functions for single-sample MCS buffers.
Paul Berry [Wed, 1 May 2013 01:51:51 +0000 (18:51 -0700)]
i965/gen7+: Create helper functions for single-sample MCS buffers.

Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agoi965/gen7+: Set up MCS in SURFACE_STATE whenever MCS is present.
Paul Berry [Wed, 1 May 2013 14:16:52 +0000 (07:16 -0700)]
i965/gen7+: Set up MCS in SURFACE_STATE whenever MCS is present.

On Gen7+, MCS buffers are used both for compressed multisampled color
buffers and for "fast clear" of single-sampled color buffers.

Previous to this patch series, we didn't support fast clear, so we
only used MCS with multisampled bolor buffers.

As a first step to implementing fast clears, this patch modifies the
code that sets up SURFACE_STATE so that it configures the MCS buffer
whenever it is present, regardless of whether we are multisampling or
not.

Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agoi965/gen7+: Create an enum for keeping track of fast color clear state.
Paul Berry [Tue, 7 May 2013 21:04:29 +0000 (14:04 -0700)]
i965/gen7+: Create an enum for keeping track of fast color clear state.

This patch includes code to update the fast color clear state
appropriately when rendering occurs.  The state will also need to be
updated when a fast clear or a resolve operation is performed; those
state updates will be added when the fast clear and resolve operations
are added.

v2: Create a new function, intel_miptree_used_for_rendering() to
handle updating the fast color clear state when rendering occurs.

Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agointel: Conditionally compile mcs-related code for i965 only.
Paul Berry [Mon, 20 May 2013 20:29:39 +0000 (13:29 -0700)]
intel: Conditionally compile mcs-related code for i965 only.

This patch ifdefs out intel_mipmap_tree::mcs_mt when building the i915
(pre-Gen4) driver (MCS buffers aren't supported until Gen7, so there
is no need for this field in the i915 driver).  This should make it a
bit easier to implement fast color clears without undue risk to i915.

Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agointel: Keep region name in intel_miptree_create_for_dri2_buffer().
Paul Berry [Tue, 28 May 2013 20:29:53 +0000 (13:29 -0700)]
intel: Keep region name in intel_miptree_create_for_dri2_buffer().

When processing a buffer received from the X server,
intel_process_dri2_buffer() examines intel_region::name to determine
whether it's received a brand new buffer, or the same buffer it
received from the X server the last time it made a request.

However, this didn't work properly, because in the call to
intel_miptree_create_for_dri2_buffer(), we create a fresh intel_region
object to represent the buffer, and this was causing us to forget the
buffer's previous name.

This patch fixes things by copying over the region name when creating
the fresh intel_region object.

At the moment, this is just a minor performance optimization.
However, when fast color clears are added, it will be necessary to
ensure that the fast color clear state for a buffer doesn't get
discarded the next time we receive that buffer from the X server.

Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agowinsys/intel: make struct intel_bo alias drm_intel_bo
Chia-I Wu [Wed, 12 Jun 2013 09:05:26 +0000 (17:05 +0800)]
winsys/intel: make struct intel_bo alias drm_intel_bo

There is really nothing in struct intel_bo, and having it alias drm_intel_bo
makes the winsys impose almost zero overhead.

We can make the overhead gone completely by making the functions static
inline, if needed.

11 years agowinsys/intel: reorganize functions
Chia-I Wu [Wed, 12 Jun 2013 08:56:49 +0000 (16:56 +0800)]
winsys/intel: reorganize functions

Move functions around to match the order of the declarations in the header.

11 years agoilo: update winsys interface
Chia-I Wu [Wed, 12 Jun 2013 08:38:38 +0000 (16:38 +0800)]
ilo: update winsys interface

The motivation is to kill tiling and pitch in struct intel_bo.  That requires
us to make tiling and pitch not queryable, and be passed around as function
parameters.

11 years agoilo: get rid of function tables in winsys
Chia-I Wu [Wed, 12 Jun 2013 08:21:00 +0000 (16:21 +0800)]
ilo: get rid of function tables in winsys

We are moving toward making struct intel_bo alias drm_intel_bo.  As a first
step, we cannot have function tables.

11 years agoilo: access bo size directly
Chia-I Wu [Tue, 11 Jun 2013 11:00:32 +0000 (19:00 +0800)]
ilo: access bo size directly

buf->bo_size is readily avaiable, no need to go via buf->bo->get_size().

11 years agoilo: remove unnecessary tex_set_bo/buf_set_bo
Chia-I Wu [Tue, 11 Jun 2013 10:51:22 +0000 (18:51 +0800)]
ilo: remove unnecessary tex_set_bo/buf_set_bo

Merge the bodies to tex_create_bo/buf_create_bo respectively.

11 years agoi965: Emit the depth/stencil state pointer directly, not via atoms.
Kenneth Graunke [Sat, 8 Jun 2013 20:20:43 +0000 (13:20 -0700)]
i965: Emit the depth/stencil state pointer directly, not via atoms.

See two commits ago for the rationale.  This allows us to delete the
whole gen7_cc_state.c file.

This does move these commands before the depth stall flushes from
brw_emit_depthbuffer, which may be a problem.  The documentation for
3DSTATE_DEPTH_BUFFER mentions that depth stall flushes are required
before changing any depth/stencil buffer state, but explicitly lists
3DSTATE_DEPTH_BUFFER, 3DSTATE_HIER_DEPTH_BUFFER, 3DSTATE_STENCIL_BUFFER,
and 3DSTATE_CLEAR_PARAMS.  It does not mention this particular packet
(_3DSTATE_DEPTH_STENCIL_STATE_POINTERS).

No observed Piglit regressions on Sandybridge or Ivybridge.

Together with the last two commits, this makes a cairo-gl benchmark
faster by 0.324552% +/- 0.258355% on Ivybridge.  No statistically
significant change on Sandybridge.  (Thanks to Eric for the numbers.)

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965: Emit the CC state pointer directly rather than via atoms.
Kenneth Graunke [Sat, 8 Jun 2013 20:14:41 +0000 (13:14 -0700)]
i965: Emit the CC state pointer directly rather than via atoms.

See the previous commit for the rationale.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965: Emit the BLEND_STATE pointer directly rather than via atoms.
Kenneth Graunke [Sat, 8 Jun 2013 19:58:17 +0000 (12:58 -0700)]
i965: Emit the BLEND_STATE pointer directly rather than via atoms.

Previously, we would:
1. Emit the new indirect state.
2. Flag CACHE_NEW_BLEND_STATE.
3. Rely on later state atoms to notice CACHE_NEW_BLEND_STATE and emit a
   pointer to the new indirect state.

This is rather cumbersome: it requires two state atoms instead of one,
and there's a strict ordering dependency in the list.  Plus, the code
gets spread across two functions (or even files in the case of Gen7+).

Gen7+ has a packet to update just the blend state pointer, so it makes a
lot of sense to simply emit that right away.  Gen6 has a combined packet
which updates blending, the color calculator, and depth/stencil state;
however, each can still be modified independently.

This drops the Gen6 micro-optimization where we tried to only emit one
packet that changed all three states.  State updates are pretty cheap.

CACHE_NEW_BLEND_STATE is no longer necessary, so drop it.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agodraw: implement distance culling
Zack Rusin [Thu, 6 Jun 2013 13:07:33 +0000 (09:07 -0400)]
draw: implement distance culling

Works similarly to clip distance. If the cull distance is negative
for all vertices against a specific plane then the primitive
is culled.

Signed-off-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
11 years agogallium: add a cull distance semantic
Zack Rusin [Thu, 6 Jun 2013 13:04:11 +0000 (09:04 -0400)]
gallium: add a cull distance semantic

cull distance is analogous to clip distance. If a register is
given this semantic, then the values in it are assumed to be a
float32 distance to a plane. Primitives will be completely
discarded if the plane distance for all of the vertices in
the primitive are < 0.

Signed-off-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
11 years agodraw: fix clipper invocation statistics
Zack Rusin [Thu, 6 Jun 2013 12:49:09 +0000 (08:49 -0400)]
draw: fix clipper invocation statistics

We need to figure out the number of invocations of the clipper
before the emit, because in the emit we are after clipping
where the number of primitives will be equal to number of clipper
invocations minus the clipped primitives. So our computations
were always off by the number of clipped primitives.

Signed-off-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
11 years agodraw: enable user plane clipping when clipdistance is used
Zack Rusin [Thu, 6 Jun 2013 03:17:10 +0000 (23:17 -0400)]
draw: enable user plane clipping when clipdistance is used

Draw depended on clip_plane_enable being set in the rasterizer
to use clipdistance registers for clipping. That's really
unfriendly because it requires that rasterizer state to have
variants for every shader out there. Instead of depending on
the rasterizer lets extract the info from the available state:
if a shader writes clipdistance then we need to use it and we
need to clip using a number of planes equal to the number
of writen clipdistance components. This way clipdistances
just work.

Signed-off-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
11 years agodraw: make sure clipdistances work with geometry shaders
Zack Rusin [Wed, 5 Jun 2013 22:06:06 +0000 (18:06 -0400)]
draw: make sure clipdistances work with geometry shaders

we were always fetching the info from the vertex shader, but if
geometry shader is present it should be used as the source of
that info.

Signed-off-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
11 years agoRevert "i965: Disable unused pipeline stages once at startup on Gen7+."
Kenneth Graunke [Tue, 11 Jun 2013 17:31:39 +0000 (10:31 -0700)]
Revert "i965: Disable unused pipeline stages once at startup on Gen7+."

This reverts commit 6c966ccf07bcaf64fba1a9b699440c30dc96e732.

Apparently causes GPU hangs.

Conflicts:
src/mesa/drivers/dri/i965/brw_state.h
src/mesa/drivers/dri/i965/brw_state_upload.c

11 years agoswrast: add texfetch code for some XBGR formats
Brian Paul [Mon, 10 Jun 2013 14:36:33 +0000 (07:36 -0700)]
swrast: add texfetch code for some XBGR formats

Fixes piglit texture-packed-formats regression.  We need to implement
more XBGR formats here eventually, but many are UINT/SINT formats
which swrast doesn't handle yet anyway (integer textures).

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

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agomesa: add missing texture strings in tex_target_name()
Brian Paul [Sun, 9 Jun 2013 16:13:00 +0000 (09:13 -0700)]
mesa: add missing texture strings in tex_target_name()

And add a static assert for the future.

11 years agowinsys/radeon: add env var to disable VM on Cayman/Trinity
Alex Deucher [Fri, 7 Jun 2013 17:55:27 +0000 (13:55 -0400)]
winsys/radeon: add env var to disable VM on Cayman/Trinity

Set env var RADEON_VA=0 to disable VM on Cayman/Trinity.
Useful for debugging.

Note: this is a candidate for the 9.1 branch.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
Reviewed-by: Marek Olšák <maraeo@gmail.com>
11 years agomesa: Add a _mesa_problem to document a piglit failure on i965.
Eric Anholt [Thu, 6 Jun 2013 06:19:27 +0000 (23:19 -0700)]
mesa: Add a _mesa_problem to document a piglit failure on i965.

Having figured out what was going on with piglit fbo-depth copypixels
GL_DEPTH_COMPONENT32F (falling all the way back to swrast on CopyPixels to
a float depth buffer), I'm not inclined to fix the problem currently but
it seems worth saving someone else the debug time.

Reviewed-by: Matt Turner <mattst88@gmail.com>
11 years agoi965/vs: Avoid the MUL/MACH/MOV sequence for small integer multiplies.
Eric Anholt [Sat, 8 Jun 2013 01:29:50 +0000 (18:29 -0700)]
i965/vs: Avoid the MUL/MACH/MOV sequence for small integer multiplies.

We do a lot of multiplies by 3 or 4 for skinning shaders, and we can avoid
the sequence if we just move them into the right argument of the MUL.

On pre-IVB, this means reliably putting a constant in a position where it
can't be constant folded, but that's still better than MUL/MACH/MOV.

Improves GLB 2.7 trex performance by 0.788648% +/- 0.23865% (n=29/30)

v2: Fix test for pre-sandybridge.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com> (v1)
11 years agoi965/vs: Allow copy propagation into MUL/MACH.
Eric Anholt [Sat, 8 Jun 2013 00:58:18 +0000 (17:58 -0700)]
i965/vs: Allow copy propagation into MUL/MACH.

This is a trivial port of 1d6ead38042cc0d1e667d8ff55937c1e32d108b1 from
the FS.

No significant performance difference on trex (misplaced the data, but it
was about n=20).

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
11 years agoi965/vs: Use the MAD instruction when possible.
Eric Anholt [Thu, 6 Jun 2013 17:14:41 +0000 (10:14 -0700)]
i965/vs: Use the MAD instruction when possible.

This is different from how we do it in the FS - we are using MAD even when
some of the args are constants, because with the relatively unrestrained
ability to schedule a MOV to prepare a temporary with that data, we can
get lower latency for the sequence of instructions.

No significant performance difference on GLB2.7 trex (n=33/34), though it
doesn't have that many MADs.  I noticed MAD opportunities while reading
the code for the DOTA2 bug.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
11 years agodraw: Add A8R8G8B8 to draw_print_arrays
Richard Sandiford [Thu, 25 Apr 2013 20:50:07 +0000 (16:50 -0400)]
draw: Add A8R8G8B8 to draw_print_arrays

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Richard Sandiford <r.sandiford@uk.ibm.com>
11 years agodraw: Fix type mismatch between draw_private.h and LLVM
Richard Sandiford [Tue, 4 Jun 2013 20:19:41 +0000 (21:19 +0100)]
draw: Fix type mismatch between draw_private.h and LLVM

draw_vertex_buffer declared the size field to be a size_t, but the LLVM
code used an int32 instead.  This caused problems on big-endian 64-bit
targets, because the first 32-bit chunk of the 64-bit size_t was always 0.

In one sense size_t seems like a good choice for a size, so one fix
would have been to try to get the LLVM code to use the equivalent of
size_t too.  However, in practice, the size is taken from things like ~0
or width0, both of which are int-sized, so it seemed simpler to make the
size field int-sized as well.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Richard Sandiford <rsandifo@linux.vnet.ibm.com>
11 years agoutil: Use sizeof(void *) rather than 0 as the fallback cache line size
Richard Sandiford [Wed, 5 Jun 2013 14:38:27 +0000 (15:38 +0100)]
util: Use sizeof(void *) rather than 0 as the fallback cache line size

Without this, llvmpipe ends up giving a zero size to all uncompressed textures
on non-x86 systems, since align() cannot handle a 0 alignment.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Richard Sandiford <rsandifo@linux.vnet.ibm.com>
11 years agollvmpipe: Use saturating add/sub for UNORM formats
Richard Sandiford [Fri, 7 Jun 2013 12:31:58 +0000 (13:31 +0100)]
llvmpipe: Use saturating add/sub for UNORM formats

lp_build_add and lp_build_sub have fallback code for cases
that cannot be handled by known intrinsics.  For UNORM formats,
this code was using modulo rather than saturating arithmetic.

This fixes some rendering issues for a gnome session on System z.
It also fixes various piglit tests on z, such as
spec/ARB_color_buffer_float/GL_RGBA8-render.

The patch deliberately doesn't tackle the more complicated
SNORM case.

Tested against piglit on x86_64 and System z with no regressions.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Richard Sandiford <rsandifo@linux.vnet.ibm.com>
11 years agointel: Reserve less batchbuffer space.
Kenneth Graunke [Sat, 8 Jun 2013 17:17:22 +0000 (10:17 -0700)]
intel: Reserve less batchbuffer space.

Now that Gen6+ relies on hardware contexts, we don't need to record an
occlusion query value at the end of each batch.  That means we no longer
need to reserve space for the absurd number of PIPE_CONTROLs required to
do that on Sandybridge.

See commit 4e087de51ad0e7ba4a7199d3664e1d096f8dc510, which bumped this
up to 60 bytes.  This is not quite a revert, as it uses 24 bytes instead
of 16, and saves the comments.  As far as I can tell, the old value of
16 bytes was just wrong, so we shouldn't go back to that.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965: Allocate push constant L3 space once at startup on Gen7+.
Kenneth Graunke [Sat, 8 Jun 2013 17:06:21 +0000 (10:06 -0700)]
i965: Allocate push constant L3 space once at startup on Gen7+.

We always allocate the maximum amount of space and never change it, so
it makes sense to do it once.  Programming it on startup also lets us
skip re-programming it from BLORP.

This removes a tiny amount of overhead from our drawing loop.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965: Disable unused pipeline stages once at startup on Gen7+.
Kenneth Graunke [Sat, 8 Jun 2013 16:57:54 +0000 (09:57 -0700)]
i965: Disable unused pipeline stages once at startup on Gen7+.

This removes a tiny bit of code from our drawing loop.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965: Don't emit PIPELINE_SELECT from BLORP.
Kenneth Graunke [Sat, 8 Jun 2013 17:01:34 +0000 (10:01 -0700)]
i965: Don't emit PIPELINE_SELECT from BLORP.

Now that we emit invariant state at startup (and never select the media
pipeline), the 3D pipeline will always already be selected, even if BLORP
is the first operation.  So this is unnecessary.

v2: Fix unused variable warning (intel_context is no longer used).

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965: Emit invariant state once at startup on Gen6+.
Kenneth Graunke [Sat, 8 Jun 2013 16:55:36 +0000 (09:55 -0700)]
i965: Emit invariant state once at startup on Gen6+.

Now that we have hardware contexts, we can safely initialize our GPU
state once at startup, rather than needing a state atom with the
BRW_NEW_CONTEXT flag set.

This removes a tiny bit of code from our drawing loop.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965: Delete some dead state atom prototypes.
Kenneth Graunke [Sat, 8 Jun 2013 16:31:31 +0000 (09:31 -0700)]
i965: Delete some dead state atom prototypes.

These atoms don't actually exist.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965: Change return type of check_state() to bool.
Kenneth Graunke [Sat, 8 Jun 2013 15:48:18 +0000 (08:48 -0700)]
i965: Change return type of check_state() to bool.

The existing code already returned a boolean; this just clarifies that.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965: Remove unused second parameter of brw_print_dirty_count().
Kenneth Graunke [Sat, 8 Jun 2013 15:46:14 +0000 (08:46 -0700)]
i965: Remove unused second parameter of brw_print_dirty_count().

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl: Allow the use of determinant() in GLSL 1.50.
Kenneth Graunke [Sat, 8 Jun 2013 07:06:52 +0000 (00:06 -0700)]
glsl: Allow the use of determinant() in GLSL 1.50.

We already implemented this for ES3, so we just need to turn it on.

Fixes 6 Piglit tests:
spec/glsl-1.50/compiler/built-in-functions/determinant-mat[234].{vert,frag}

Reviewed-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglcpp: Automatically #define GL_core_profile 1 on GLSL 1.50+.
Kenneth Graunke [Sat, 8 Jun 2013 05:04:23 +0000 (22:04 -0700)]
glcpp: Automatically #define GL_core_profile 1 on GLSL 1.50+.

Page 17 of the GLSL 1.50.11 specification states:
"There is a built-in macro definition for each profile the
 implementation supports.  All implementations provide the following
 macro:

Reviewed-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl: Parse "#version 150 core" directives.
Kenneth Graunke [Sat, 8 Jun 2013 04:28:59 +0000 (21:28 -0700)]
glsl: Parse "#version 150 core" directives.

Previously we only supported "#version 150".  This patch recognizes
"compatibility" to give the user a more descriptive error message.

Fixes Piglit's version-150-core-profile test.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl: Bail on parsing if the #version directive is bogus.
Kenneth Graunke [Sat, 8 Jun 2013 04:46:04 +0000 (21:46 -0700)]
glsl: Bail on parsing if the #version directive is bogus.

If we didn't successfully parse the #version line, there's no point in
continuing with parsing and compiling: it's already failed.

Furthermore, it can actually be harmful: right after handling #version,
we call _mesa_glsl_initialize_types(), which checks state->es_shader and
language_version.  If it isn't valid, it hits an assertion failure.

Fixes Piglit's "invalid-version-es."  When processing "#version 110 es",
our code set state->es_shader and state->language_version = 110.  It
then properly determined that this was invalid and flagged an error.
Since we continued anyway, we hit the assertion mentioned above.

NOTE: This is a candidate for the 9.1 branch.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agodlist: fix save_SamplerParameteri
Chris Forbes [Sun, 9 Jun 2013 21:17:16 +0000 (09:17 +1200)]
dlist: fix save_SamplerParameteri

This was building the temporary array to pass to
save_SamplerParameteriv, and then not passing it.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Vinson Lee <vlee@freedesktop.org>
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
11 years agomesa: Prevent possible out-of-bounds read by save_SamplerParameteriv.
Vinson Lee [Thu, 6 Jun 2013 06:01:00 +0000 (23:01 -0700)]
mesa: Prevent possible out-of-bounds read by save_SamplerParameteriv.

Fixes "Out-of-bounds access" defect reported by Coverity.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agonvc0: fix up video buffer alignment requirements
Maarten Lankhorst [Sat, 8 Jun 2013 18:09:25 +0000 (20:09 +0200)]
nvc0: fix up video buffer alignment requirements

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
11 years agofreedreno: better scissor fix
Rob Clark [Sat, 1 Jun 2013 18:16:30 +0000 (14:16 -0400)]
freedreno: better scissor fix

Actually respect rasterizer state.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
11 years agofreedreno: gmem bypass
Rob Clark [Mon, 27 May 2013 00:36:35 +0000 (20:36 -0400)]
freedreno: gmem bypass

The GPU (at least a3xx, but I think also a2xx) can render directly to
memory, bypassing tiling.  Although it can't do this if blend, depth,
and a few other features of the pipeline are enabled.  This direct
memory mode can be faster for some sorts of operations, such as simple
blits.  In particular, this significantly speeds up XA by avoiding to
pull the entire dest pixmap into GMEM, render tiles, and write it all
back out again.  This should also speed up resource copy-region and
blit.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
11 years agofreedreno: add a3xx support
Rob Clark [Sun, 26 May 2013 21:13:44 +0000 (17:13 -0400)]
freedreno: add a3xx support

The adreno a3xx GPU is found in newer snapdragon devices, such as the
nexus4.  The a3xx is GLESv3 and OpenCL capable, although that is not
enabled yet in gallium.

Compared to a2xx, it introduces an entirely new unified shader ISA, and
re-shuffles all or nearly all of the registers.  The good news is that
(for the most part) the registers are more orthogonal, not combining
unrelated state in a single register.  And that there is a lot more
flexibility, so we don't need to patch and re-emit the shader like we
did on a2xx.

The shader compiler is currently quite dumb, there would be a lot of
room for improvement with an optimizing pass.  Despite that, with the
a320 in my nexus4 it seems to be ~2-3x faster compared to the a220 in my
HP touchpad.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
11 years agofreedreno: prepare for a3xx
Rob Clark [Sun, 26 May 2013 21:13:27 +0000 (17:13 -0400)]
freedreno: prepare for a3xx

Split the parts that are specific to adreno a2xx series GPUs from the
parts that will be in common with a3xx, so that a3xx support can be
added more cleanly.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
11 years agogallivm: work around slow code generated for interleaving 128bit vectors
Roland Scheidegger [Fri, 7 Jun 2013 19:20:01 +0000 (21:20 +0200)]
gallivm: work around slow code generated for interleaving 128bit vectors

We use 128bit vector interleave for untwiddling in the blend code (with
256bit vectors). llvm generates terrible code for this for some reason,
so instead of generating a shuffle for 2 128bit vectors use a
extract/insert shuffle instead (it only seems to matter we're not using
128bit wide vectors for the shuffle). This decreases instruction count of
the blend code generated for a rgba8 render target without blending from
169 to 113 with llvm 3.1 and from 136 to 114 in llvm 3.2/3.3, and I got
a ~8% (llvm 3.1) and ~5% (3.2/3.3) performance improvement in gears.
(The generated code is still not terribly good as we could actually avoid
the interleaving completely but llvm can't know this.)

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agoscons: Fix implicit python dependency discovery on Windows.
José Fonseca [Sat, 8 Jun 2013 07:55:06 +0000 (08:55 +0100)]
scons: Fix implicit python dependency discovery on Windows.

Probably due to CRLF endings, the discovery of python import statements
was not working on Windows builds, causing incremental builds to often
fail unless one wiped out the build directory.

NOTE: This is a candidate for stable branches.

11 years agost/xlib: Flush the front buffer before doing CopySubBuffer
Stéphane Marchesin [Sat, 11 May 2013 01:30:46 +0000 (18:30 -0700)]
st/xlib: Flush the front buffer before doing CopySubBuffer

We flush pending rendering before running CopySubBuffer, which
ensures that the right bits get to the screen.

NOTE: This is a candidate for stable release branches.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agost/xlib: Fix upside down coordinates for CopySubBuffer
Stéphane Marchesin [Sat, 11 May 2013 01:29:52 +0000 (18:29 -0700)]
st/xlib: Fix upside down coordinates for CopySubBuffer

The coordinates need to be inverted between glX and gallium.

NOTE: This is a candidate for stable release branches.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agomesa: Report core FBO incompleteness cases through GL_ARB_debug_output.
Eric Anholt [Thu, 6 Jun 2013 18:13:02 +0000 (11:13 -0700)]
mesa: Report core FBO incompleteness cases through GL_ARB_debug_output.

Just like we produce from inside the Intel driver, this can help provide
information quickly about FBO incompatibility problems (particularly when
using apitrace replay).

Currently, in driver-marked incompleteness cases, you'll get both the
driver message and the core message on Intel.  Until the other drivers are
fixed to produce output, I think this is better than not putting in a
message for driver-marked incomplete.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agointel: flush fake front buffer if server is about to destroy it.
Paul Berry [Fri, 31 May 2013 16:45:49 +0000 (09:45 -0700)]
intel: flush fake front buffer if server is about to destroy it.

Fixes piglit test "spec/!OpenGL 1.0/gl-1.0-front-invalidate-back"

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
11 years agointel: flush fake front buffer more robustly.
Paul Berry [Wed, 29 May 2013 16:48:26 +0000 (09:48 -0700)]
intel: flush fake front buffer more robustly.

When a fake front buffer is in use, if we request the front buffer
(using screen->dri2.loader->getBuffersWithFormat()), the X server
copies the real front buffer to the fake front buffer and returns the
fake front buffer.  We sometimes make redundant requests for the front
buffer (due to using a single counter to track invalidates for both
the front and back buffers), so there's a danger of pending front
buffer rendering getting overwritten when the redundant front buffer
request occurs.

Previous to this patch, intel_update_renderbuffers() worked around
that problem by sometimes doing intel_flush() and intel_flush_front()
before calling intel_query_dri2_buffers().  But it only did the
workaround when the front buffer was bound for drawing; it didn't do
it when the front buffer was bound for reading.

This patch moves the workaround code to intel_query_dri2_buffers(), so
that it happens in exactly the circumstances where it is needed.

This should fix some of the sporadic failures in Piglit tests
fbo-sys-blit and fbo-sys-sub-blit.

Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
11 years agointel: make intel_flush_front safe to call during initial MakeCurrent
Paul Berry [Thu, 30 May 2013 14:08:07 +0000 (07:08 -0700)]
intel: make intel_flush_front safe to call during initial MakeCurrent

The patch that follows will fix a bug that prevents
intel_flush_front() from being called often enough.  In doing so, it
will create a situation where intel_flush_front() is called during the
initial call to glXMakeCurrent().  In this circumstance,
ctx->DrawBuffer hasn't been initialized yet and is NULL.  Fortunately,
intel->front_buffer_dirty is false, so intel_flush_front() doesn't
actually need to do anything.  To avoid a segfault, swap the order of
terms in intel_flush_front()'s if statement.

Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
11 years agomesa: Expose MAX_FRAGMENT_INPUT_COMPONENTS on ES3 and desktop 3.2.
Eric Anholt [Wed, 5 Jun 2013 21:46:19 +0000 (14:46 -0700)]
mesa: Expose MAX_FRAGMENT_INPUT_COMPONENTS on ES3 and desktop 3.2.

piglit OpenGL ES 3.0/minmax now passes.  This was also one of the subcase
failures in OpenGL 3.2/minmax (and still is, because our value is too low
for 3.2, but at least we report what it is).

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agomesa: Expose texture array getters on GLES3.
Eric Anholt [Wed, 5 Jun 2013 21:37:36 +0000 (14:37 -0700)]
mesa: Expose texture array getters on GLES3.

Part of fixing piglit OpenGL ES 3.0/minmax.

v2: s/_gles3/_es3/ in extra name, for consistency (review by Matt).

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> (v1)
11 years agomesa: Fix the return value of TEXTURE_BINDING_2D_ARRAY.
Eric Anholt [Wed, 5 Jun 2013 23:20:18 +0000 (16:20 -0700)]
mesa: Fix the return value of TEXTURE_BINDING_2D_ARRAY.

Noticed by inspection when reviewing the next commit.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agomesa: Expose texel offset limits in GLES3.
Eric Anholt [Wed, 5 Jun 2013 21:27:34 +0000 (14:27 -0700)]
mesa: Expose texel offset limits in GLES3.

Part of fixing piglit OpenGL ES 3.0/minmax.

v2: s/_gles3/_es3/ in extra name, for consistency (review by Matt).

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> (v1)
11 years agoutil: add comment about bogus transfer flags
Roland Scheidegger [Fri, 7 Jun 2013 19:12:22 +0000 (21:12 +0200)]
util: add comment about bogus transfer flags

11 years agoutil: fix util_clear_render_target and util_clear_depth_stencil layer handling
Roland Scheidegger [Fri, 7 Jun 2013 19:10:59 +0000 (21:10 +0200)]
util: fix util_clear_render_target and util_clear_depth_stencil layer handling

These functions must clear all bound layers, not just the first.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agollvmpipe: move create_surface/destroy_surface functions to lp_surface.c
Roland Scheidegger [Fri, 7 Jun 2013 00:27:49 +0000 (02:27 +0200)]
llvmpipe: move create_surface/destroy_surface functions to lp_surface.c

Believe it or not but these two are actually the first two functions which
really belong in this file nowadays.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agollvmpipe: add support for layered rendering
Roland Scheidegger [Fri, 7 Jun 2013 19:03:40 +0000 (21:03 +0200)]
llvmpipe: add support for layered rendering

Mostly just make sure the layer parameter gets passed through to the right
places (and get clamped, can do this at setup time), fix up clears to
clear all layers and disable opaque optimization. Luckily don't need to
touch the jitted code.
(Clears invoked via pipe's clear_render_target method will not work however
since the pipe_util_clear function used for it doesn't handle clearing
multiple layers yet.)

v2: per Brian's suggestion, prettify var initialization and add some comments,
add assertion for impossible layer specification for surface.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agogallium/docs: fix up transfer description for 1d arrays, add cube map arrays
Roland Scheidegger [Fri, 7 Jun 2013 18:54:54 +0000 (20:54 +0200)]
gallium/docs: fix up transfer description for 1d arrays, add cube map arrays

Transfers always use z/depth for layers no matter if it's a 1d or 2d array
texture, we don't follow OpenGL's crazyness there. Luckily this appears to
only be a doc bug, everyone doing the right thing already.
While here also document z/depth parameter for cube map arrays.

v2: fix typo spotted by Eric Anholt

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agoilo: fix textureSize() for single-layered array textures
Chia-I Wu [Fri, 7 Jun 2013 07:10:19 +0000 (15:10 +0800)]
ilo: fix textureSize() for single-layered array textures

We returned 0 instead of 1 for the number of layers when the array texutre is
single-layered.  This fixed it on GEN7+.

11 years agoutil: add util_resource_is_array_texture()
Chia-I Wu [Fri, 7 Jun 2013 06:52:48 +0000 (14:52 +0800)]
util: add util_resource_is_array_texture()

Checking if array_size is greater than 1 is not enough for single-layered
array textures.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agodocs: update some environment variable info
Brian Paul [Fri, 7 Jun 2013 16:12:28 +0000 (10:12 -0600)]
docs: update some environment variable info

Drop the GALLIUM_NOSSE/PPC env vars, added ST_DEBUG and some of the
VMware SVGA driver env vars.

11 years agogallium: Remove draw_arrays() and draw_arrays_instanced() functions
Arnas Milasevicius [Thu, 6 Jun 2013 22:21:19 +0000 (01:21 +0300)]
gallium: Remove draw_arrays() and draw_arrays_instanced() functions

Moved draw_arrays() to st_draw_feedback.c and removed draw_arrays_instanced().
draw_arrays() was used by nobody else.  Now there's just one "draw" entrypoint
into the draw module.

Signed-off-by: Brian Paul <brianp@vmware.com>
11 years agotgsi: replace tgsi_file_names tgsi_file_names[] with tgsi_file_name() function
Brian Paul [Thu, 6 Jun 2013 15:46:40 +0000 (09:46 -0600)]
tgsi: replace tgsi_file_names tgsi_file_names[] with tgsi_file_name() function

This change came from the discovery that the STATIC_ASSERT to check that
the number of register file strings didn't actually work.

Similar changes could be made for the other string arrays in tgsi_string.c

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agou_vbuf: fix index buffer leak
Chia-I Wu [Tue, 4 Jun 2013 08:39:07 +0000 (16:39 +0800)]
u_vbuf: fix index buffer leak

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Marek Olšák <maraeo@gmail.com>
11 years agoi965/vs: add support for emitting gl_ClipVertex
Chris Forbes [Mon, 20 May 2013 10:10:29 +0000 (22:10 +1200)]
i965/vs: add support for emitting gl_ClipVertex

Removes the special-case suppression of gl_ClipVertex in the VUE map.

Also calculate vertex outcodes for user clip planes based on
gl_ClipVertex if written; otherwise gl_Position.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965/clip: Add support for gl_ClipVertex
Chris Forbes [Mon, 20 May 2013 09:51:43 +0000 (21:51 +1200)]
i965/clip: Add support for gl_ClipVertex

When clipping triangles against a user clip plane, and gl_ClipVertex
is provided in the vertex, use it instead of hpos.

TODO: A similar change should be made at some point for line clipping.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoilo: advertise PIPE_CAP_CUBE_MAP_ARRAY
Chia-I Wu [Fri, 7 Jun 2013 05:39:41 +0000 (13:39 +0800)]
ilo: advertise PIPE_CAP_CUBE_MAP_ARRAY

It was supported but not advertised.  Also remove TODO tag for
PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT, as it is not a TODO.

11 years agoilo: add support for TEX2/TXB2/TXL2 in fs
Chia-I Wu [Fri, 7 Jun 2013 06:18:59 +0000 (14:18 +0800)]
ilo: add support for TEX2/TXB2/TXL2 in fs

They were already supported, just being rejected in the TGSI translator.

11 years agoglsl linker: Initialize member variable interface_namespace.
Vinson Lee [Fri, 24 May 2013 06:48:28 +0000 (23:48 -0700)]
glsl linker: Initialize member variable interface_namespace.

Fixes "Uninitialized pointer field" defect reported by Coverity.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoilo: use slab allocator for transfers
Chia-I Wu [Fri, 7 Jun 2013 05:11:49 +0000 (13:11 +0800)]
ilo: use slab allocator for transfers

Slab allocator is perfect for transfer.  Improved OpenArena performance by 1%
with several casual runs.

11 years agoilo: clean up states upon context destroy
Chia-I Wu [Tue, 4 Jun 2013 08:20:05 +0000 (16:20 +0800)]
ilo: clean up states upon context destroy

We need to unreference resources that we referenced.

11 years agoilo: unmap cp bo before destroying it
Chia-I Wu [Tue, 4 Jun 2013 05:25:38 +0000 (13:25 +0800)]
ilo: unmap cp bo before destroying it

The BOs are mapped in their entire life times for the chipsets we support so
do not forget to unmap it.

11 years agoilo: enable bo reuse
Chia-I Wu [Wed, 5 Jun 2013 18:41:21 +0000 (02:41 +0800)]
ilo: enable bo reuse

This magical line of code must have got lost at some point in the history...

11 years agoilo: construct 3DSTATE_SF in create_rasterizer_state()
Chia-I Wu [Wed, 5 Jun 2013 04:04:46 +0000 (12:04 +0800)]
ilo: construct 3DSTATE_SF in create_rasterizer_state()

Add ilo_rasterizer_sf and initialize it in create_rasterizer_state().

11 years agoilo: construct 3DSTATE_CLIP in create_rasterizer_state()
Chia-I Wu [Tue, 4 Jun 2013 10:37:23 +0000 (18:37 +0800)]
ilo: construct 3DSTATE_CLIP in create_rasterizer_state()

Add ilo_rasterizer_clip and initialize it in create_rasterizer_state().

11 years agoilo: use emit_SURFACE_STATE() for render targets
Chia-I Wu [Mon, 3 Jun 2013 07:34:13 +0000 (15:34 +0800)]
ilo: use emit_SURFACE_STATE() for render targets

Introduce ilo_surface_cso and initialize it in create_surface().  With the
change, we can emit SURFACE_STATE directly from the CSO and remove
emit_surf_SURFACE_STATE().  We do not deal with depth/stencil surfaces yet.

11 years agoilo: use emit_SURFACE_STATE() for constant buffers
Chia-I Wu [Mon, 3 Jun 2013 07:25:48 +0000 (15:25 +0800)]
ilo: use emit_SURFACE_STATE() for constant buffers

Introduce ilo_cbuf_cso and initialize it in set_constant_buffer().  As
ilo_view_surface is embedded in ilo_cbuf_cso, switch to emit_SURFACE_STATE()
for constant buffers and remove emit_cbuf_SURFACE_STATE().

11 years agoilo: add emit_SURFACE_STATE() for sampler views
Chia-I Wu [Thu, 6 Jun 2013 03:28:02 +0000 (11:28 +0800)]
ilo: add emit_SURFACE_STATE() for sampler views

Introduce ilo_view_cso and initialize it in create_sampler_view().  Add
emit_SURFACE_STATE() to GPE, which can emit SURFACE_STATE from
ilo_view_surface.

11 years agoilo: add ilo_view_surface for SURFACE_STATE
Chia-I Wu [Thu, 6 Jun 2013 03:16:13 +0000 (11:16 +0800)]
ilo: add ilo_view_surface for SURFACE_STATE

Define struct ilo_view_surface for SURFACE_STATE construction and emission.

11 years agoilo: convert generic depth-stencil-alpha pipe state to ilo pipe state
Courtney Goeltzenleuchter [Fri, 31 May 2013 19:43:11 +0000 (13:43 -0600)]
ilo: convert generic depth-stencil-alpha pipe state to ilo pipe state

Moving the work to create time reduces the work at emit time.
Saves time overall as create work is only done once.
Fix compiler warning in gen7_pipeline_sol.

[olv: remember pipe_alpha_state instead of pipe_depth_stencil_alpha_state in
      ilo_dsa_state]

11 years agoilo: introduce vertex element CSO
Chia-I Wu [Fri, 31 May 2013 18:00:55 +0000 (02:00 +0800)]
ilo: introduce vertex element CSO

Introduce ilo_ve_cso and initialize it in create_vertex_elements_state().
This commit goes a step further by setting up mappings from HW VB to PIPE VB,
which we failed to do previously.  That allows us to support instanced
rendering.

11 years agoilo: simplify emit_3DSTATE_DEPTH_BUFFER()
Chia-I Wu [Mon, 3 Jun 2013 04:35:01 +0000 (12:35 +0800)]
ilo: simplify emit_3DSTATE_DEPTH_BUFFER()

Remove hiz and dsa from the parameters.  We would know whether HiZ buffer
exists from ilo_texture once it is supported.  DSA state should not affect
3DSTATE_DEPTH_BUFFER.

11 years agoilo: introduce blend CSO
Chia-I Wu [Fri, 31 May 2013 08:11:38 +0000 (16:11 +0800)]
ilo: introduce blend CSO

Introduce ilo_blend_cso and initialize it in create_blend_state().  This saves
us from having to construct hardware blend states in draw_vbo().

11 years agoilo: introduce sampler CSO
Chia-I Wu [Fri, 31 May 2013 03:52:47 +0000 (11:52 +0800)]
ilo: introduce sampler CSO

Introduce ilo_sampler_cso and initialize it in create_sampler_state().  This
saves us from having to perform CPU-intensive calculations to construct
hardware sampler states in draw_vbo().