Commit graph

47325 commits

Author SHA1 Message Date
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
Eric Anholt
b4d988bc9f mesa: Don't do [0, 1] clamping on glGetTexImage() of packed float formats.
From the GL_EXT_packed_float spec:

    For an RGBA color, if <type> is not one of FLOAT,
    UNSIGNED_INT_5_9_9_9_REV_EXT, or UNSIGNED_INT_10F_11F_11F_REV_EXT,
    or if the CLAMP_READ_COLOR_ARB is TRUE, or CLAMP_READ_COLOR_ARB
    is FIXED_ONLY_ARB and the selected color (or texture) buffer is
    a fixed-point buffer, each component is first clamped to [0,1].
    Then the appropriate conversion formula from table 4.7 is applied
    the component."

(but we previously resolved that the CLAMP_READ_COLOR bit is not
relevant to glGetTexImage())

This fixes most of the cases in piglit GL_EXT_packed_float/pack.

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
3d7477206d u_format: Fix bitshifting for unpacking from 10F.
This code was copy and pasted from the 11F unpacking, but not updated
for actually being 10 bits instead of 11.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=41206
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
028ce1cd0f u_format: Fix bit definition of UF10_MANTISSA_BITS.
This is only used in the code for packing to INF, and resulted in an
extra bit set that was set anyway, so it was harmless except for the
confusion caused.

Reviewed-by: Marek Olšák <maraeo@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2011-10-28 12:09:47 -07:00
Eric Anholt
687e4446bf glsl: Implement GLSL 1.30's literal integer range restrictions.
From page 22 (28 of PDF) of GLSL 1.30 spec:
    It is an error to provide a literal integer whose magnitude is too
    large to store in a variable of matching signed or unsigned type.

    Unsigned integers have exactly 32 bits of precision.  Signed integers
    use 32 bits, including a sign bit, in two's complement form.

Fixes piglit int-literal-too-large-0[123].frag.

v2: Take care with INT_MIN, use stroull, and make it a function.

Reviewed-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2011-10-28 12:03:03 -07:00
Eric Anholt
974c66875e radeon: Remove the non-libdrm kernel memory manager support.
We should have never been building this at this point.
2011-10-28 11:32:10 -07:00
Eric Anholt
830e546f94 radeon: Insist on libdrm being present to build.
There's no sense in building a broken driver.  Previously, there was
the potential of building a DRI1-only driver that would work for DRI1
and fail on DRI2 because the newer libdrm code wasn't present.  Now
the radeon build system should be matching intel and nouveau.
2011-10-28 11:32:00 -07:00
Eric Anholt
48c9925367 configure.ac: Fix equality checks in gallium st setup. 2011-10-28 11:31:11 -07:00
Eric Anholt
bd51e8e4f4 dri: Remove driver GenerateMipmap hooks.
Mesa sets up _mesa_meta_GenerateMipmap as the default hook, which does
this check for fallback and call the fallback itself.
2011-10-28 11:31:11 -07:00
Eric Anholt
eb135fe8c1 radeon: Drop some remaining DRI1 vblank support code. 2011-10-28 11:31:11 -07:00
Eric Anholt
a9f7515890 intel: remove dead prototype for old DRI1 code.
Noticed while grepping for radeon code.
2011-10-28 11:31:11 -07:00
Eric Anholt
339c1731c3 radeon: Simplify cliprects computation now that there's just 1.
This can probably be reduced even further by moving this logic to the
scissor state update or just removing the logic entirely, but I don't
trust myself in radeon quite that much.
2011-10-28 11:31:11 -07:00