Commit graph

41853 commits

Author SHA1 Message Date
Eric Anholt
44c65d0e4e i965: Remove the prepare() hook from state atoms.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Paul Berry <stereotype441@gmail.com>
2011-10-29 12:17:26 -07:00
Eric Anholt
2649ff4d90 i965: Remove the memcpy()ed atoms array now that everything is emit()-based.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Paul Berry <stereotype441@gmail.com>
2011-10-29 12:17:23 -07:00
Eric Anholt
35c7e8cebe i965: Merge brw_validate_state() and brw_upload_state() together.
They were called back-to-back at this point.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Paul Berry <stereotype441@gmail.com>
2011-10-29 12:17:21 -07:00
Eric Anholt
68c813e8ea i965: Remove state upload code for calling prepare() now that there are none.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Paul Berry <stereotype441@gmail.com>
2011-10-29 12:17:17 -07:00
Eric Anholt
26cfca825d i965: Remove some old texturing debug code.
It caught one possible bug I recall in my time working on the driver,
and we haven't been setting it for non-fixed-function since the new FS
backend came along.  The bug it caught was likely a confusion about
sampler mappings, which we have tests for these days.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Paul Berry <stereotype441@gmail.com>
2011-10-29 12:17:15 -07:00
Eric Anholt
bd27c25ff9 i965: Finally, move the global fallbacks check to emit() time.
This was the last prepare() function, and it's the first state atom,
so it must be ready to move.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Paul Berry <stereotype441@gmail.com>
2011-10-29 12:17:13 -07:00
Eric Anholt
c83bfeabc6 i965: Move index buffer upload to emit() time.
It's consumed by the brw_emit_index_buffer() code at emit() time.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Paul Berry <stereotype441@gmail.com>
2011-10-29 12:17:11 -07:00
Eric Anholt
78a010127f i965: Do a hack job of merging VB prepare()/emit() together.
I don't really want to touch this impenetrable code in this series, so
just call the one function from the other, since no other atom cares
about them.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Paul Berry <stereotype441@gmail.com>
2011-10-29 12:17:09 -07:00
Eric Anholt
bf11c9e4c1 i965: Move the WM input sizes calculation to emit() time.
It's used for program compile.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Paul Berry <stereotype441@gmail.com>
2011-10-29 12:17:07 -07:00
Eric Anholt
dc9a753f66 i965: Move program compile to emit() time.
Only 4 other prepare() functions are left, which don't rely on this.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Paul Berry <stereotype441@gmail.com>
2011-10-29 12:17:03 -07:00
Eric Anholt
0969568fce i965/gen4: Move CURBE offset calculation to emit() time.
This is consumed by the unit state.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Paul Berry <stereotype441@gmail.com>
2011-10-29 12:17:01 -07:00
Eric Anholt
47c4d950cb i965/gen4: Fold push constant prepare()/emit() together.
While other units need to know about our constant buffer offsets,
nothing else cared about which particular BO other than the emit() half.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Paul Berry <stereotype441@gmail.com>
2011-10-29 12:16:59 -07:00
Eric Anholt
752cad8f33 i965/gen6: Move viewport state setup to emit() time.
Only the emit() for the pointers into the batch later in this file
cares.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Paul Berry <stereotype441@gmail.com>
2011-10-29 12:16:56 -07:00
Eric Anholt
8f0a54e6ff i965/gen4: Move URB fence recalculate to emit() time.
This is used by the unit state, which is at emit() time.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Paul Berry <stereotype441@gmail.com>
2011-10-29 12:16:54 -07:00
Eric Anholt
ab8637b03f i965: Fold the gen6/7 URB state prepare()/emit() together.
No other unit cares about the prepare state, unlike gen4-5.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Paul Berry <stereotype441@gmail.com>
2011-10-29 12:16:49 -07:00
Eric Anholt
395a8605fa i965: Move VS pull constant upload to emit() time.
Only needed by the emit() for VS surfaces.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Paul Berry <stereotype441@gmail.com>
2011-10-29 12:16:45 -07:00
Eric Anholt
c933b33dc8 i965: Fold prepare() and emit() of VS surface state setup together.
This rearranges the code a bit, and makes the upload of the binding
table take only as many surfaces as there are in use.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Paul Berry <stereotype441@gmail.com>
2011-10-29 12:16:42 -07:00
Eric Anholt
2b730c1f19 i965: Move WM pull constant setup to emit() time.
It's needed by the WM surface state setup, which is now emit().

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Paul Berry <stereotype441@gmail.com>
2011-10-29 12:16:39 -07:00
Eric Anholt
4de2cfc3a0 i965/gen7: Fold WM surface state prepare()/emit() together.
These produce BRW_NEW_SURFACES (used by binding table emit()) and
BRW_NEW_NR_WM_SURFACES (used by WM unit emit()).  Fixes a bug where
with no texturing and no color buffer, we wouldn't consider the null
renderbuffer in nr_surfaces.  This was harmless because nr_surfaces is
only used for the prefetch info in the unit state.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Paul Berry <stereotype441@gmail.com>
2011-10-29 12:16:36 -07:00
Eric Anholt
93cabff7d6 i965/gen4: Fold WM surface state prepare()/emit() together.
These produce BRW_NEW_SURFACES (used by binding table emit()) and
BRW_NEW_NR_WM_SURFACES (used by WM unit emit()).  Fixes a bug where
with no texturing and no color buffer, we wouldn't consider the null
renderbuffer in nr_surfaces.  This was harmless because nr_surfaces is
only used for the prefetch info in the unit state.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Paul Berry <stereotype441@gmail.com>
2011-10-29 12:16:32 -07:00
Eric Anholt
9a5f8a98ed i965: Move sampler state to emit() time.
This is consumed by the WM unit, which is already at emit().

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Paul Berry <stereotype441@gmail.com>
2011-10-29 12:16:30 -07:00
Eric Anholt
c4aaf85285 i965/gen4: Move unit state setup to emit() time.
It is only needed in time for brw_psp_urb_cbs(), which is also an emit().

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Paul Berry <stereotype441@gmail.com>
2011-10-29 12:16:27 -07:00
Eric Anholt
c0574d5a90 i965/gen7: Fold prepare() and emit() of SF CLIP/VP state together.
The prepare() only made state for its emit(), not anybody else.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Paul Berry <stereotype441@gmail.com>
2011-10-29 12:16:24 -07:00
Eric Anholt
7a874d04a8 i965/gen4: Move CC VP to emit() time, since it's only needed by CC's emit().
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Paul Berry <stereotype441@gmail.com>
2011-10-29 12:16:20 -07:00
Eric Anholt
9015969e6e i965: Move push constants setup to emit() time.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Paul Berry <stereotype441@gmail.com>
2011-10-29 12:16:18 -07:00
Eric Anholt
f84f3322b4 i965/gen6: Move setup of CC state batches to emit time.
This is part of a series trying to eliminate the separate prepare()
hook in state upload.  The prepare() hook existed to support the
check_aperture in between calculating state updates and setting up the
batch, but there should be no reason for that any more.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Paul Berry <stereotype441@gmail.com>
2011-10-29 12:16:15 -07:00
Eric Anholt
78188bc537 i965: Check Fallback again after upload.
As we move state to emit() time from prepare() time, a couple of the
places that flag fallbacks will move here.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Paul Berry <stereotype441@gmail.com>
2011-10-29 12:16:12 -07:00
Eric Anholt
eaf4d3e6e2 i965: Remove the validated BO list, now that it's unused.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Paul Berry <stereotype441@gmail.com>
2011-10-29 12:16:09 -07:00
Eric Anholt
3d851ae488 i965: Use the batch save/reset code to avoid needing the BO validate step.
We were doing the BO validate step in prepare() (brw_validate_state())
hooks of atoms so that we could check_aperture before emitting the
relocation trees during brw_upload_state() that would actually make
the batchbuffer reference too much memory to be executed.  Now that
all relocations occur in the batchbuffer, we can instead
check_aperture after emitting our state into the batchbuffer, and
easily roll back, flush, and retry if we happened to go over the
limits.

This will let us remove the whole prepare() vs emit() split in our
state atoms, which is a source of tricky dependencies and duplicated
code.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Paul Berry <stereotype441@gmail.com>
2011-10-29 12:16:05 -07:00
Eric Anholt
da8f052560 intel: Return error value from intel_batchbuffer_flush().
This will let the caller do something sensible on error, if it cares.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Paul Berry <stereotype441@gmail.com>
2011-10-29 12:16:02 -07:00
Eric Anholt
fff693828e i965: Add a note about an unsafe-looking state check.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Paul Berry <stereotype441@gmail.com>
2011-10-29 12:15:59 -07:00
Eric Anholt
3faf56ffbd intel: Add an interface for saving/restoring the batchbuffer state.
This will be used to avoid the prepare() step in the i965 driver's
state setup.  Instead, we can just speculatively emit the primitive
into the batchbuffer, then check if the batch is too big, rollback and
flush, and replay the primitive.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Paul Berry <stereotype441@gmail.com>
2011-10-29 12:15:56 -07:00
Eric Anholt
db364a8af0 i915: Move the always_flush_cache code to triangle emit.
This could have broken always_flush_cache on i965, since
reserved_space doesn't reflect the size of the workaround flushes, and
we might run out of space.  This should make always_flush_cache more
useful on pre-i965, anyway (since the point is to flush around each
draw call, even within a batchbuffer).

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Paul Berry <stereotype441@gmail.com>
2011-10-29 12:15:33 -07:00
Morgan Armand
439d67f502 glsl: Fix compilation of glsl_lexer.ll with MSVC.
strtoull is not supported on msvc (as there is no C99 support).
2011-10-29 10:37:58 -07:00
Mathias Fröhlich
e8139ebf58 r600g: Replace needless flush in texture upload.
Replace pipe->flush() with pipe->texture_barrier() in
the texture upload path for the staging texture.
This should be enough to get data out of the gpu
caches ready to be read for texture fetch.
2011-10-29 18:36:42 +02:00
Marek Olšák
7684808f9c r600g: remove one pointless flush
It's not useful for anything.
The rest of the patch is just a cleanup resulting
from some of the variables being no longer used.

There are no piglit regressions.
2011-10-29 13:48:39 +02:00
Dave Airlie
09a92e376b radeon/r200: forgot one somehow
drops last usage.
2011-10-29 08:15:27 +01:00
Dave Airlie
b490fa0172 radeon/r200: drop remains of non-libdrm_radeon build
These wrappers and associated symlinks were from the non-libdrm_radeon build.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2011-10-29 08:13:47 +01:00
Dave Airlie
4dfee0011a mesa/st: get interpolation mode from the fragment shader.
With the recent changes to interpolation stuff, we can now get the value
direct from the program instead of just being fail.

fixes some of the glsl-1.30 interpolation tests with softpipe

Signed-off-by: Dave Airlie <airlied@redhat.com>
2011-10-29 07:41:46 +01:00
Adam Jackson
25620eb1d2 glx: Don't enable INTEL_swap_event unconditionally
DRI2 supports this now - and already enables it explicitly - but drisw
does not and should not.  Otherwise toolkits like clutter will only ever
SwapBuffers once and wait forever for an event that's not coming.

Signed-off-by: Adam Jackson <ajax@redhat.com>
2011-10-28 20:38:32 -04:00
Morgan Armand
0c6a2c78fd implement WGL_ARB_create_context
Signed-off-by: José Fonseca <jfonseca@vmware.com>
2011-10-28 21:58:36 +01:00
Marek Olšák
bbad5103e6 r600g: get backend mask after the context is fully set up 2011-10-28 22:55:01 +02:00
Ian Romanick
276000472a ir_to_mesa: Let check_resources halt compilation
Previously check_resources could fail, but we'd still try to optimize
the shader, do device-specific code generation, etc.  In some cases,
this could explode (especially in the device-specific code
generation).  I haven't found that I could trigger this with the
current code.  When too many samplers were used with the new uniform
handling code, I observed several crashes deep down in the driver.

NOTE: This is candidate for the 7.11 branch.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=41609
Cc: Eric Anholt <eric@anholt.net>
Reviewed-and-tested-by: Kenneth Graunke <kenneth@whitecape.org>
2011-10-28 13:28:55 -07:00
Ian Romanick
6da9b21f71 i965: Use glsl_type::column_type instead of open-coding it
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2011-10-28 13:28:55 -07:00
Ian Romanick
f5ba4d055e glsl: Clean-up spurious error message on bad structure definitions
Previously a shader like

int X;
struct X { int i; };

void main() { gl_Position = vec4(0.0); }

would generate two error message:

0:2(19): error: struct `X' previously defined
0:2(20): error: incomplete declaration

The first one is the real error, and the second is spurious.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2011-10-28 13:28:55 -07:00
Ian Romanick
a04211ecb8 glsl: Generate an error for array-of-array declarations
Other parts of the code already caught things like 'float x[4][2]'.
However, nothing caught 'float [4] x[2]'.

Fixes piglit test array-multidimensional-new-syntax.vert.

NOTE: This is candidate for the 7.11 branch.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2011-10-28 13:28:36 -07:00
Marek Olšák
e79aaf000b r300c/compiler: remove the compiler too
Gallium has a fork of this.
2011-10-28 21:28:31 +02:00
Kenneth Graunke
512431b357 i965/fs: Use the actual hardware g0 register for texel offset setup.
The idea here is to set up the message header with the Sampler State
pointer which the hardware provides as part of the PS Thread Payload in
register g0.

Unfortunately, the existing code

   fs_reg(GRF, 0, BRW_REGISTER_TYPE_UD))

actually references "virtual GRF 0" rather than the hardware g0.  This
is just some arbitrary GRF temporary which will get register allocated.

So, we ended up setting up the header with garbage.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
2011-10-28 12:11:52 -07:00
Eric Anholt
058e712415 u_format: Fix -NaN handling for packing of 10F_11F_11F_REV to match GL specs.
Fixes the remainder of piglit GL_EXT_packed_float/pack.c

Reviewed-by: Marek Ol ák <maraeo@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2011-10-28 12:10:01 -07:00
Eric Anholt
00d3716f4a u_format: Fix clamping of overflow in 10F_11F_11F_REV to match GL specs.
Fixes the 1000000.0 overflow cases of piglit
GL_EXT_packed_float/pack.c

Reviewed-by: Marek Ol ák <maraeo@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2011-10-28 12:10:01 -07:00