mesa.git
11 years agoutil: Add util_copy_box helper.
José Fonseca [Wed, 5 Dec 2012 20:15:40 +0000 (20:15 +0000)]
util: Add util_copy_box helper.

Must users of util_copy_rect() need or should deal with volumes.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agogallium/util: Move the util_copy/fill_rect into u_surface.
José Fonseca [Wed, 5 Dec 2012 09:04:21 +0000 (09:04 +0000)]
gallium/util: Move the util_copy/fill_rect into u_surface.

u_rect.h said these should move to a different file, and u_surface seems
a better home.

Leave #include "util/u_surface.h" to avoid having to touch thousand of
files.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agogallium/os: Cleanup up os_time_get/os_time_get_nano.
José Fonseca [Wed, 5 Dec 2012 08:59:21 +0000 (08:59 +0000)]
gallium/os: Cleanup up os_time_get/os_time_get_nano.

- Re-implement os_time_get in terms of os_time_get_nano() for consistency
- Use CLOCK_MONOTONIC as recommended
- Only use clock_gettime on Linux for now.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agogallium/os: Fix os_time_sleep() on Windows for small durations.
José Fonseca [Tue, 4 Dec 2012 19:44:08 +0000 (19:44 +0000)]
gallium/os: Fix os_time_sleep() on Windows for small durations.

Prevents undetermined sleeps.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agometa: Disable GL_FRAGMENT_SHADER_ATI in MESA_META_SHADER
Stefan Dösinger [Wed, 5 Dec 2012 22:08:21 +0000 (23:08 +0100)]
meta: Disable GL_FRAGMENT_SHADER_ATI in MESA_META_SHADER

Fixes clears in Wine on r200.

NOTE: This is a candidate for stable release branches.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agoradeon: Initialize swrast before setting limits
Stefan Dösinger [Wed, 5 Dec 2012 22:08:20 +0000 (23:08 +0100)]
radeon: Initialize swrast before setting limits

NOTE: This is a candidate for stable release branches.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agor200: Initialize swrast before setting limits
Stefan Dösinger [Wed, 5 Dec 2012 22:08:19 +0000 (23:08 +0100)]
r200: Initialize swrast before setting limits

Otherwise the driver announces 4096 vertex shader constants and other
way too high limits.

NOTE: This is a candidate for stable release branches.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agomesa: fix compiler warnings when including GL/gl.h with other gl headers
Matthew Waters [Sun, 2 Dec 2012 11:28:34 +0000 (22:28 +1100)]
mesa: fix compiler warnings when including GL/gl.h with other gl headers

GL/gl.h provides some definitions (GL_FALSE, GL_ONE, etc) that have
the same value as other gl headers but are represented differently
(0 vs 0x0 and 1 vs 0x1).
This causes compiler warnings about redefining such definitions when
including GL/gl.h with other gl headers.

Fixes http://bugs.freedesktop.org/show_bug.cgi?id=57802

Signed-off-by: Brian Paul <brianp@vmware.com>
11 years agogallivm: Fix lerping of (un)signed normalized numbers.
José Fonseca [Thu, 6 Dec 2012 09:30:53 +0000 (09:30 +0000)]
gallivm: Fix lerping of (un)signed normalized numbers.

Several issues actually:

- Fix a regression in unsigned normalized in the rescaling
  [0, 255] to [0, 256]

- Ensure we use signed shifts where appropriate (instead of
  unsigned shifts)

- Refactor the code slightly -- move all the logic inside
  lp_build_lerp_simple().

This change, plus an adjustment in the tolerance of signed normalized
results in piglit fbo-blending-formats fixes bug 57903

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agogallivm: Fix lp_build_print_value of smaller integer types.
José Fonseca [Thu, 6 Dec 2012 08:50:46 +0000 (08:50 +0000)]
gallivm: Fix lp_build_print_value of smaller integer types.

They need to be converted to the native integer type to prevent garbage
in higher order bits from being printed.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agollvmpipe: remove unused variable
Brian Paul [Thu, 6 Dec 2012 15:34:08 +0000 (08:34 -0700)]
llvmpipe: remove unused variable

11 years agodraw: remove some dead constant buffer code
Brian Paul [Thu, 6 Dec 2012 00:18:30 +0000 (17:18 -0700)]
draw: remove some dead constant buffer code

Remove the draw_vs_set_constants() and draw_gs_set_constants()
functions and the draw->vs.aligned_constants,
draw->vs.aligned_constant_storage and draw->vs.const_storage_size
fields.  None of it was used.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
11 years agoandroid: Fix build of libmesa_program
Chad Versace [Thu, 6 Dec 2012 05:34:26 +0000 (21:34 -0800)]
android: Fix build of libmesa_program

Commit 4097308 fixed the build in a questionable way. It worked at the
time, but, as Ian pointed out, the fix would likely fail at a future
commit due to the indeterminism of parallel builds. And that's exactly
what happened; the fix no longer works. `mm -j4` on Fedora 17 fails for
me.

The problem is that there is no rule for program_parse.tab.h. To fix that,
this patch adds a rule that makes program_parse.tab.c depend on
program_parse.tab.h. Technically, the c file does not depend on the
h file. However, because the two files are generated together by a single
invocation of Bison, any rule that forces execution of Bison is
sufficient.

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
11 years agollvmpipe: EXT_transform_feedback support (v1.1)
Dave Airlie [Tue, 4 Dec 2012 20:50:07 +0000 (06:50 +1000)]
llvmpipe: EXT_transform_feedback support (v1.1)

I'd written most of this ages ago, but never finished it off.

This passes 115/130 piglit tests so far. I'll look into the
others as time permits.

v1.1: fix calloc return check as suggested by Jose.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agoi965: Add a debug flag for counting cycles spent in each compiled shader.
Eric Anholt [Tue, 27 Nov 2012 22:10:52 +0000 (14:10 -0800)]
i965: Add a debug flag for counting cycles spent in each compiled shader.

This can be used for two purposes: Using hand-coded shaders to determine
per-instruction timings, or figuring out which shader to optimize in a
whole application.

Note that this doesn't cover the instructions that set up the message to
the URB/FB write -- we'd need to convert the MRF usage in these
instructions to GRFs so that our offsets/times don't overwrite our
shader outputs.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> (v1)
v2: Check the timestamp reset flag in the VS, which is apparently
    getting set fairly regularly in the range we watch, resulting in
    negative numbers getting added to our 32-bit counter, and thus large
    values added to our uint64_t.
v3: Rebase on reladdr changes, removing a new safety check that proved
    impossible to satisfy.  Add a comment to the AOP defs from Ken's
    review, and put them in a slightly more sensible spot.
v4: Check timestamp reset in the FS as well.

11 years agoi965: Add a flag for instructions with normal writemasking disabled.
Eric Anholt [Wed, 28 Nov 2012 22:16:03 +0000 (14:16 -0800)]
i965: Add a flag for instructions with normal writemasking disabled.

For getting values from the new timestamp register, the channels we
load have nothing to do with the pixels dispatched.

11 years agor600g: use default action for min/max opcode in tgsi to llvm
Vincent Lejeune [Thu, 29 Nov 2012 22:46:15 +0000 (23:46 +0100)]
r600g: use default action for min/max opcode in tgsi to llvm

Reveiwed-by: Tom Stellard <thomas.stellard at amd.com>
11 years agogallivm: Have a default emit function for min/max opcode
Vincent Lejeune [Thu, 29 Nov 2012 22:43:31 +0000 (23:43 +0100)]
gallivm: Have a default emit function for min/max opcode

Reveiwed-by: Tom Stellard <thomas.stellard at amd.com>
11 years agor600g: use default action for fdiv/rcp opcode
Vincent Lejeune [Thu, 29 Nov 2012 22:45:30 +0000 (23:45 +0100)]
r600g: use default action for fdiv/rcp opcode

Reveiwed-by: Tom Stellard <thomas.stellard at amd.com>
11 years agogallivm: have a default emit function for fdiv/rcp
Vincent Lejeune [Thu, 29 Nov 2012 22:43:05 +0000 (23:43 +0100)]
gallivm: have a default emit function for fdiv/rcp

Reveiwed-by: Tom Stellard <thomas.stellard at amd.com>
11 years agor600g: Use default mul/mad function for tgsi-to-llvm
Vincent Lejeune [Tue, 27 Nov 2012 23:35:55 +0000 (00:35 +0100)]
r600g: Use default mul/mad function for tgsi-to-llvm

Reveiwed-by: Tom Stellard <thomas.stellard at amd.com>
11 years agoglsl: add new variable declaration in function body in lower_output_read
Vincent Lejeune [Fri, 23 Nov 2012 16:53:06 +0000 (17:53 +0100)]
glsl: add new variable declaration in function body in lower_output_read

Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
11 years agodraw: set precalc_flat flag for AA lines too
Brian Paul [Tue, 4 Dec 2012 23:32:01 +0000 (16:32 -0700)]
draw: set precalc_flat flag for AA lines too

Fixes flat shading for AA lines.  demos/src/trivial/line-smooth is a
test case which hits this.

Note: This is a candidate for the stable branches.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agomesa: expose ARB_texture_cube_map_array in core contexts as well
Chris Forbes [Wed, 5 Dec 2012 05:03:04 +0000 (18:03 +1300)]
mesa: expose ARB_texture_cube_map_array in core contexts as well

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Dave Airlie <airlied@gmail.com>
11 years agoscons: Require drm to build gallium/state_trackers/egl/x11/x11_screen.c.
Vinson Lee [Tue, 4 Dec 2012 07:24:12 +0000 (23:24 -0800)]
scons: Require drm to build gallium/state_trackers/egl/x11/x11_screen.c.

x11_screen.c includes xf86drm.h, which comes from libdrm-dev.

This patch fixes this build error.

  Compiling src/gallium/state_trackers/egl/x11/x11_screen.c ...
src/gallium/state_trackers/egl/x11/x11_screen.c:30:21: fatal error: xf86drm.h: No such file or directory

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: José Fonseca <jfonseca@vmware.com>
11 years agoi965/fs: Add support for uniform array access with a variable index.
Eric Anholt [Fri, 9 Nov 2012 00:06:24 +0000 (16:06 -0800)]
i965/fs: Add support for uniform array access with a variable index.

Serious Sam 3 had a shader hitting this path, but it's used rarely so it
didn't show a significant performance difference (n=7).  It does reduce
compile time massively, though -- one shader goes from 14s compile time
and 11723 instructions generated to .44s and 499 instructions.

Note that some shaders lose 16-wide mode because we don't support
16-wide and pull constants at the moment (generally, things looping over
a few-element array where the loop isn't getting unrolled).  Given that
those shaders are being generated with 15-20% fewer instructions, it
probably outweighs the loss of 16-wide.

11 years agoi965/fs: Conditionalize constant-index UBO load code and add comments.
Eric Anholt [Thu, 8 Nov 2012 23:55:36 +0000 (15:55 -0800)]
i965/fs: Conditionalize constant-index UBO load code and add comments.

I wanted to separate this step for easier reviewing when I add the
variable-index case next.

11 years agoi965/fs: Restrict optimization that would fail for gen7's SENDs from GRFs
Eric Anholt [Fri, 9 Nov 2012 19:48:20 +0000 (11:48 -0800)]
i965/fs: Restrict optimization that would fail for gen7's SENDs from GRFs

v2: Fix SNB math bug in register_coalesce() where I was looking at the
    instruction to be removed, not the instruction to be copy propagated
    into.

11 years agoi965/fs: Allow source mods on gen7+ math.
Eric Anholt [Mon, 26 Nov 2012 18:23:07 +0000 (10:23 -0800)]
i965/fs: Allow source mods on gen7+ math.

This gen6 restriction was removed in gen7 as the mathbox merge to act
more like a normal instruction was finished in the hardware.

11 years agoi965/fs: Add instruction emit for varying-index reads of uniforms.
Eric Anholt [Wed, 7 Nov 2012 19:18:34 +0000 (11:18 -0800)]
i965/fs: Add instruction emit for varying-index reads of uniforms.

The gen7 send-from-GRF path is sufficiently different from the perspective of
IR generation and optimization that I just made it a separate opcode.

v2: fix whitespace, rebase on Ken's recent refactor.

11 years agoi965/fs: Rename the existing pull constant load opcode.
Eric Anholt [Wed, 7 Nov 2012 18:42:34 +0000 (10:42 -0800)]
i965/fs: Rename the existing pull constant load opcode.

We're going to use another send message for handling loads with a varying
per-fragment array index.

11 years agoi965: Add a header_present flag for setting up dp read messages.
Eric Anholt [Fri, 9 Nov 2012 19:17:48 +0000 (11:17 -0800)]
i965: Add a header_present flag for setting up dp read messages.

As of gen7, we can skip the header on some messages, and this can make
optimization on those messages much nicer when you've got GRFs instead of MRFs
as the source.

11 years agoi965/gen7: Add some safety checks for send messages from GRFs.
Eric Anholt [Fri, 9 Nov 2012 19:38:14 +0000 (11:38 -0800)]
i965/gen7: Add some safety checks for send messages from GRFs.

11 years agogallivm: Re-add the kludge for lp_build_lerp of fixed point types.
José Fonseca [Tue, 4 Dec 2012 21:16:13 +0000 (21:16 +0000)]
gallivm: Re-add the kludge for lp_build_lerp of fixed point types.

I removed it in commit 7d44d354bdba853e453ce3991396e2b0933468f4 but
texture sample code still relies on it.

Not sure how to this cleanly, so put it pack for now.

11 years agoscons: Link against librt
José Fonseca [Tue, 4 Dec 2012 19:36:52 +0000 (19:36 +0000)]
scons: Link against librt

Fixes missing clock_gettime symbol.

11 years agoutil/u_debug: Cleanup/fix debug_dump_image.
José Fonseca [Sun, 2 Dec 2012 18:57:53 +0000 (18:57 +0000)]
util/u_debug: Cleanup/fix debug_dump_image.

- Handle other formats.
- Prevent CRLF on Windows.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agotranslate: Fix the fetch function assertions.
José Fonseca [Wed, 21 Nov 2012 16:17:22 +0000 (16:17 +0000)]
translate: Fix the fetch function assertions.

fetch_rgba_float is NULL for integer formats, and vice-versa.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agoutil/u_draw: Skip rendering instead of aborting when excessive number of instances...
José Fonseca [Fri, 16 Nov 2012 17:57:38 +0000 (17:57 +0000)]
util/u_draw: Skip rendering instead of aborting when excessive number of instances is found.

This is a temporary hack. I believe the only way of properly fixing this
is to check buffer overflow just before fetching based on addresses,
instead of number of vertices/instances. This change simply allows tests
that stress buffer overflows to complete without asserting, and should
not affect valid rendering.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agodraw: Properly limit vertex buffer fetches on draw arrays.
José Fonseca [Fri, 16 Nov 2012 17:09:05 +0000 (17:09 +0000)]
draw: Properly limit vertex buffer fetches on draw arrays.

We need to clamp vertex buffer fetch based on its size, not based on the
user specified max index hint.

This matches draw_pt_fetch_run() above.

NOTE: This is a candidate for the stable branches.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agodraw: Use symbolic primitive names in debug output.
José Fonseca [Thu, 15 Nov 2012 20:36:55 +0000 (20:36 +0000)]
draw: Use symbolic primitive names in debug output.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agodraw: Consider the geometry shader when choosing the vertex size.
José Fonseca [Thu, 15 Nov 2012 20:35:20 +0000 (20:35 +0000)]
draw: Consider the geometry shader when choosing the vertex size.

A single vertex size is chosen for the whole pipeline. So the number of
geometry shader outputs must also be taken in consideration.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agotgsi: Allow TXF from buffers.
José Fonseca [Thu, 15 Nov 2012 14:20:35 +0000 (14:20 +0000)]
tgsi: Allow TXF from buffers.

There is more work necessary to properly support buffers in shaders, but
this gets things a bit further along.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agoutil/surface: Always use the surface format when clearing.
José Fonseca [Thu, 15 Nov 2012 14:19:55 +0000 (14:19 +0000)]
util/surface: Always use the surface format when clearing.

Not the texture format, as they might differ.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agotgsi: Increase maximum number of temps to 4096.
José Fonseca [Thu, 15 Nov 2012 09:16:59 +0000 (09:16 +0000)]
tgsi: Increase maximum number of temps to 4096.

To match Shader Model 4 limits, as specified in
http://msdn.microsoft.com/en-us/library/windows/desktop/ff471378.aspx

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agollvmpipe: Fix alignment.
José Fonseca [Tue, 4 Dec 2012 19:09:28 +0000 (19:09 +0000)]
llvmpipe: Fix alignment.

My understanding and actual implementation of how the pixels are being
fetch differed.

This fixes bug 57863.

Trivial.

11 years agogallivm: Generalize lp_build_mul and lp_build_lerp for signed normalized types.
José Fonseca [Tue, 4 Dec 2012 13:38:52 +0000 (13:38 +0000)]
gallivm: Generalize lp_build_mul and lp_build_lerp for signed normalized types.

This fixes fdo bug 57755 and most of the failures of piglit fbo-blending-formats
GL_EXT_texture_snorm.

GL_INTENSITY_SNORM is still failing, but problem is probably elsewhere,
as GL_R8_SNORM works fine.

11 years agoautomake/gallium: attempt to fix -lrt
Dave Airlie [Mon, 3 Dec 2012 23:25:13 +0000 (09:25 +1000)]
automake/gallium: attempt to fix -lrt

fix non-automake bits in pipe-load to.

Should fix:
http://bugs.freedesktop.org/57852

Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agou_cache: fix dereference before NULL check
Dave Airlie [Fri, 30 Nov 2012 08:48:47 +0000 (18:48 +1000)]
u_cache: fix dereference before NULL check

11 years agointel: Always enable GL_ARB_framebuffer_object
Ian Romanick [Sat, 1 Dec 2012 18:56:40 +0000 (10:56 -0800)]
intel: Always enable GL_ARB_framebuffer_object

Now that _mesa_BindFramebuffer does the right thing in ES contexts when the
gl_extensions::ARB_framebuffer_object bit is set, the Intel driver doesn't
need this hack.

No piglit or GLES2 conformance regressions observed on IVB, and this
patch (and the previous) fix es3conform's framebuffer_srgb_draw and
transform_feedback_misc tests.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agomesa: Only require Gen'ed name for glBind{Framebuffer,Renderbuffer} on desktop
Ian Romanick [Sat, 1 Dec 2012 18:50:57 +0000 (10:50 -0800)]
mesa: Only require Gen'ed name for glBind{Framebuffer,Renderbuffer} on desktop

Desktop OpenGL implementations that support either
GL_ARB_framebuffer_object or OpenGL 3.0 must require names from
glGenFramebuffers for glBindFramebuffer.  We have enforced this rule for
quite some time.  However, OpenGL ES 1.0, 2.0, and 3.0 implementations
are required to allow user-defined names (e.g., not from
glGenFramebuffers{OES,}).

The Intel drivers have hacked around this by not enabling
GL_ARB_framebuffer_object in an ES context.  Instead, just pick the
correct behavior in _mesa_BindFramebuffer based on the context API.

Chad pointed out in a review e-mail:

    "I'd like to point out, though, that glBindFramebufferEXT and
    glBindRenderbufferEXT are still broken on desktop GL because they
    don't accept user-genned names. But that fix belongs to a different
    series."

Currently glBindFramebufferEXT is an alias for glBindFramebuffer.
Unalising two functions presents some difficulty, so we'll have to
revisit this eventually.

v2: Perform same check in _mesa_BindRenderbuffer too.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> [v1]
11 years agomesa: fix uint64 printing in syncobj.c
Brian Paul [Mon, 3 Dec 2012 15:37:10 +0000 (08:37 -0700)]
mesa: fix uint64 printing in syncobj.c

To silence printf format warnings.

v2: insert "0x" prefix

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
11 years agomesa: Disable GL_NV_primitive_restart extension in core contexts.
Kenneth Graunke [Mon, 3 Dec 2012 06:30:45 +0000 (22:30 -0800)]
mesa: Disable GL_NV_primitive_restart extension in core contexts.

The NV formulation of primitive restart is turned on/off with
glEnableClientState/glDisableClientState.  These two functions don't
exist in core contexts, which mean that GL_NV_primitive_restart is
essentially useless...even broken.

However, leaving it on causes oglconform's primitive-restart-nv tests to
run in OpenGL 3.1 contexts, which results in them all failing.  This
patch causes 29 subtests to go from "fail" to "not run".

NOTE: This is a candidate for stable branches.

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agoi965: Allow INTEL_DEBUG=fs as a synonym for INTEL_DEBUG=wm.
Kenneth Graunke [Mon, 3 Dec 2012 04:36:16 +0000 (20:36 -0800)]
i965: Allow INTEL_DEBUG=fs as a synonym for INTEL_DEBUG=wm.

I keep accidentally trying to use it.  "fs" is a sensible name for
fragment shader debugging, and "wm" is...not.  It's also more symmetric
with "vs".

Leave INTEL_DEBUG=wm because old habits die hard.

Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agogallium/auxiliary: Add -fno-rtti to CXXFLAGS on LLVM >= 3.2.
Johannes Obermayr [Fri, 30 Nov 2012 22:53:58 +0000 (23:53 +0100)]
gallium/auxiliary: Add -fno-rtti to CXXFLAGS on LLVM >= 3.2.

Also remove the recently added and overloaded LLVM_CXXFLAGS from CXXFLAGS.

Note: This is a candidate for the stable branches.

Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
11 years agor300g: Give CLIP_DISABLE another try
Stefan Dösinger [Mon, 3 Dec 2012 16:40:52 +0000 (17:40 +0100)]
r300g: Give CLIP_DISABLE another try

Signed-off-by: Marek Olšák <maraeo@gmail.com>
11 years agoi965: Include codegen time in the INTEL_DEBUG=perf stall detection.
Eric Anholt [Fri, 30 Nov 2012 20:55:50 +0000 (12:55 -0800)]
i965: Include codegen time in the INTEL_DEBUG=perf stall detection.

In the VS case, we were missing the entire compile time in the stall
detection!

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965: Don't leak the IR annotation into later instructions.
Eric Anholt [Fri, 30 Nov 2012 00:51:13 +0000 (16:51 -0800)]
i965: Don't leak the IR annotation into later instructions.

After walking our IR instructions (Mesa or GLSL), we don't want to also
mark the start of the FB/URB writes or whatever as being that IR.  This
can end up being misleading when the end of the IR visit got copy
propagated out to a later instruction in the URB writes.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965/vp: Fix crashes with INTEL_DEBUG=vs.
Eric Anholt [Fri, 30 Nov 2012 21:02:11 +0000 (13:02 -0800)]
i965/vp: Fix crashes with INTEL_DEBUG=vs.

The VP generation doesn't set up the output reg strings, so if you
didn't happen to get these values as 0 on the stack, you'd lose.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965/vs: Fix uninitialized shader pointer used in debug output.
Eric Anholt [Fri, 30 Nov 2012 00:49:36 +0000 (16:49 -0800)]
i965/vs: Fix uninitialized shader pointer used in debug output.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoandroid: fix bison warning of conflicting outputs to file
Adrian Marius Negreanu [Fri, 30 Nov 2012 07:52:20 +0000 (09:52 +0200)]
android: fix bison warning of conflicting outputs to file

Bison -o parameter expects a .c file.
The corresponding .h filename is obtained
by removing the extension of the initial .c.

This was breaking compilation on Ubuntu 12.04

libmesa_dricore_intermediates/libmesa_dricore.a(program_parse.tab.o): In
function `_mesa_parse_arb_program':
external/mesa/src/mesa/program/program_parse.y:2682: multiple definition
of `_mesa_parse_arb_program'
libmesa_dricore_intermediates/libmesa_dricore.a(lex.yy.o):external/mesa/src/mesa/program/program_parse.y:2682:
first defined here

Signed-off-by: Adrian Marius Negreanu <adrian.m.negreanu@intel.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-and-tested-by: Chad Versace <chad.versace@linux.intel.com>
11 years agost/mesa: add null pointer check in st_renderbuffer_delete()
Brian Paul [Mon, 3 Dec 2012 15:30:04 +0000 (08:30 -0700)]
st/mesa: add null pointer check in st_renderbuffer_delete()

In my testing I haven't found any cases where we get a null context
pointer, but it might still be possible.  Check for null just to be safe.

Note: This is a candidate for the stable branches.

11 years agost/glx: accept GLX_SAMPLE_BUFFERS/SAMPLES_ARB == 0
Brian Paul [Sun, 2 Dec 2012 23:18:22 +0000 (16:18 -0700)]
st/glx: accept GLX_SAMPLE_BUFFERS/SAMPLES_ARB == 0

Only fail if GLX_SAMPLE_BUFFERS_ARB or GLX_SAMPLES_ARB are non-zero.
We were already doing this in the older swrast/glx code.

This fixes a piglit/waffle problem where we'd always fail to get a
visual/config and report the test as "skip".

Note: This is a candidate for the stable branches.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agomesa: remove warning message in _mesa_reference_renderbuffer_()
Brian Paul [Sat, 1 Dec 2012 17:52:42 +0000 (10:52 -0700)]
mesa: remove warning message in _mesa_reference_renderbuffer_()

We were warning when there was no current context and we're about
to delete a renderbuffer, but that happens fairly often and isn't
really a problem.

Fixes http://bugs.freedesktop.org/show_bug.cgi?id=57754

Note: This is a candidate for the stable branches.

Tested-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agollvmpipe: Implement PIPE_QUERY_TIMESTAMP and PIPE_QUERY_TIME_ELAPSED.
James Benton [Mon, 3 Dec 2012 07:00:37 +0000 (07:00 +0000)]
llvmpipe: Implement PIPE_QUERY_TIMESTAMP and PIPE_QUERY_TIME_ELAPSED.

This required an update for the query storage in llvmpipe, there
can now be an active query per query type, so an occlusion query
can run at the same time as a time elapsed query.

Based on PIPE_QUERY_TIME_ELAPSED patch from Dave Airlie.

v2: fix up piglits for timers (also from Dave Airlie)

a) if we don't render anything the result is 0, so just
return the current time

b) add missing screen get_timestamp callback.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: José Fonseca <jfonseca@vmware.com>
11 years agogallivm: fix srgb format fetch
Roland Scheidegger [Sat, 1 Dec 2012 16:04:54 +0000 (17:04 +0100)]
gallivm: fix srgb format fetch

we need to rely on util code for fetching those, just like before
9f06061d50f90bf425a5337cea1b0adb94a46d25.
Fixes bugs 57699 and 57756.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: José Fonseca <jfonseca@vmware.com>
11 years agollvmpipe: Refactor convert_to/from_blend_type to convert in place.
José Fonseca [Fri, 30 Nov 2012 18:06:46 +0000 (18:06 +0000)]
llvmpipe: Refactor convert_to/from_blend_type to convert in place.

This fixes the "Source and destination overlap in memcpy" valgrind
warnings.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
11 years agollvmpipe: Improve color buffer loads/stores alignment.
José Fonseca [Mon, 3 Dec 2012 13:55:45 +0000 (13:55 +0000)]
llvmpipe: Improve color buffer loads/stores alignment.

Tell LLVM the exact alignment we can guarantee, based on the fs block
dimensions, pixel format, and the alignment of the resource base pointer
and stride.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
11 years agollvmpipe: Recompute the fs shader key when framebuffer varies.
José Fonseca [Fri, 30 Nov 2012 17:32:29 +0000 (17:32 +0000)]
llvmpipe: Recompute the fs shader key when framebuffer varies.

The fs shader now depends on the color buffer formats. The shader key was
extended to accommodate this, but llvmpipe_update_derived needs to be
updated to check the framebuffer dirty flag.

This fixes bug 57674.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
11 years agor300g: increment num_z_clears only if we have Hyper-Z
Marek Olšák [Sun, 2 Dec 2012 21:22:39 +0000 (22:22 +0100)]
r300g: increment num_z_clears only if we have Hyper-Z

11 years agor300g: add blacklist for apps that shouldn't steal hyperz access
Marek Olšák [Sun, 2 Dec 2012 18:26:16 +0000 (19:26 +0100)]
r300g: add blacklist for apps that shouldn't steal hyperz access

11 years agor300g: enable Hyper-Z by default on r500
Marek Olšák [Sun, 2 Dec 2012 16:06:49 +0000 (17:06 +0100)]
r300g: enable Hyper-Z by default on r500

I fixed the only known bugs on r500 with 0222b2bd4107b9e5cabfbc06c1a6ca3eae.
Now there are no piglit regressions with Hyper-Z and all apps I tested seem
to work.

To summarize how it works:
- Only one process can use it at a time. This is a hardware limitation.
- The first process to clear a zbuffer gets the exclusive access to use
  Hyper-Z.
- Compositors don't use any zbuffer, so they won't steal it, but some web
  browsers do, so make sure there's no web browser running if you want your
  game to use Hyper-Z.
- There's no need to restart an app which couldn't get the access to Hyper-Z.
  Just quit the app which took it, the driver can turn it on for the other app
  in the middle of rendering.
- If an app gets the access to Hyper-Z, it prints "radeon: Acquired Hyper-Z"
  to stdout.

r300-r400:
  Hyper-Z will be enabled by default on r300-r400 once sufficient testing is
  done with piglit and Lightsmark at least.
  Be sure to set the env var RADEON_HYPERZ and run piglit with parameters: -c 0

11 years agor300g: clear the ZB cache before clearing ZMASK or HIZ
Marek Olšák [Sun, 2 Dec 2012 04:41:48 +0000 (05:41 +0100)]
r300g: clear the ZB cache before clearing ZMASK or HIZ

This fixes wrong rendering in Lightsmark and
the piglit/depthstencil-render-miplevels.

I think I fixed Hyper-Z. So far every app seems to work like a charm.

11 years agoRevert "r300g: fix occlusion queries when depth test is disabled or zbuffer is missing"
Marek Olšák [Sun, 2 Dec 2012 03:40:36 +0000 (04:40 +0100)]
Revert "r300g: fix occlusion queries when depth test is disabled or zbuffer is missing"

It broke Hyper-Z terribly.

11 years agodri: Fix i965 build
Chad Versace [Sun, 2 Dec 2012 01:03:59 +0000 (17:03 -0800)]
dri: Fix i965 build

The following commit broke the i965 build:

    commit 4a486f8bf2ca3d88228f8313282289abe78bc2f8
    Author: Marek Olšák <maraeo@gmail.com>
    Date:   Fri Nov 23 18:31:42 2012 +0100

    glx/dri2: add and use new driver hook flush_with_flags

That commit added a forward declaration of enum __DRI2throttleReason to
dri_interface.h. C++ 98 does not allow forward declarations of enums.

The fix: Move the enum's definition to earlier in the file.

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
11 years agost/dri: implement new driver hook flush_with_flags
Marek Olšák [Fri, 23 Nov 2012 17:33:54 +0000 (18:33 +0100)]
st/dri: implement new driver hook flush_with_flags

v2: added documentation for dri_flush as per Brian's request

11 years agost/mesa: make st_flush do what glFlush does
Marek Olšák [Fri, 23 Nov 2012 16:42:11 +0000 (17:42 +0100)]
st/mesa: make st_flush do what glFlush does

11 years agoglx/dri2: add and use new driver hook flush_with_flags
Marek Olšák [Fri, 23 Nov 2012 17:31:42 +0000 (18:31 +0100)]
glx/dri2: add and use new driver hook flush_with_flags

11 years agoglx: move the glFlush call one layer down
Marek Olšák [Tue, 13 Nov 2012 16:06:37 +0000 (17:06 +0100)]
glx: move the glFlush call one layer down

11 years agor300g: refuse to create too large textures
Marek Olšák [Sat, 1 Dec 2012 21:40:00 +0000 (22:40 +0100)]
r300g: refuse to create too large textures

11 years agor300g: fix memory leaks in texture_create error paths
Marek Olšák [Sat, 1 Dec 2012 21:38:36 +0000 (22:38 +0100)]
r300g: fix memory leaks in texture_create error paths

11 years agor300g: fix revoking hyperz access
Marek Olšák [Sat, 1 Dec 2012 20:18:59 +0000 (21:18 +0100)]
r300g: fix revoking hyperz access

The bug was uncovered by 67c8e96f5ace67f9c17556934ee9532877d3a00.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=57763

11 years agogallivm: drop border wrap clamping code
Roland Scheidegger [Fri, 30 Nov 2012 19:46:23 +0000 (20:46 +0100)]
gallivm: drop border wrap clamping code

The border clamping code is unnecessary, since we don't care if a wrapped
coord value is -1 or <-1 (same for length vs. >length), in either case the
border handling code will mask out the offset and replace the texel value with
the border color.
Note that technically this is not entirely correct. Omitting clamping on the
float coords means that flt->int conversion may result in undefined values for
values of very large magnitude.
However there's no reason we should honor this here since:
a) we don't care for that for ordinary wrap modes in the aos code when
   converting coords and the problem is worse there (as we've got only
   effectively 24 instead of 32bits)
b) at least in some cases the clamping was done already in int space hence
   doing nothing to fix that problem.
c) with sse2 flt->int conversion with such values results in 0x80000000 which
   is just perfect (for clamp to border - not so much for the ordinary clamp to
   edge).

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agor300g: handle map flag DISCARD_WHOLE_RESOURCE
Marek Olšák [Fri, 30 Nov 2012 14:23:41 +0000 (15:23 +0100)]
r300g: handle map flag DISCARD_WHOLE_RESOURCE

This should improve performance in apps which trigger this codepath.
(e.g. Wine does)

12 years agoradeon: Fix memory leak in radeonCreateScreen2.
Vinson Lee [Fri, 30 Nov 2012 07:10:03 +0000 (23:10 -0800)]
radeon: Fix memory leak in radeonCreateScreen2.

Fixes a memory leak defect reported by Coverity.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
12 years agonouveau: Fix build.
Brian Paul [Sat, 1 Dec 2012 03:11:21 +0000 (19:11 -0800)]
nouveau: Fix build.

Fixes nouveau build failure introduced at
c73245882c7ff1277b190b97f093f7b423a22f10.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=57746
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
12 years agoglsl: fix uninitialised variable from constructor
Dave Airlie [Fri, 30 Nov 2012 10:24:33 +0000 (20:24 +1000)]
glsl: fix uninitialised variable from constructor

Coverity pointed out this uninitialised class member.

Note: This is a candidate for stable branches.

Reviewed-by: Brian Paul <brianp@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agoglsl: initialise killed_all field.
Dave Airlie [Fri, 30 Nov 2012 10:23:20 +0000 (20:23 +1000)]
glsl: initialise killed_all field.

coverity pointed out this field was being used uninitialised.

Note: This is a candidate for stable branches.

Reviewed-by: Brian Paul <brianp@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agosvga: remove pointless assert on unsigned >= 0
Dave Airlie [Fri, 30 Nov 2012 10:02:39 +0000 (20:02 +1000)]
svga: remove pointless assert on unsigned >= 0

all unsigneds are >= 0 :-)

There may be an argument for leaving this in, in case someone
changes min_lod to an integer, so feel free to apply or drop.

Reviewed-by: Brian Paul <brianp@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agoglsl: fix cut-n-paste error in error handling. (v2)
Dave Airlie [Fri, 30 Nov 2012 08:33:21 +0000 (18:33 +1000)]
glsl: fix cut-n-paste error in error handling. (v2)

Reported by coverity scan.

v2: fix second case

Note: This is a candidate for stable branches.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agor300g: fix comparison of hyperz flush time.
Dave Airlie [Fri, 30 Nov 2012 08:27:51 +0000 (18:27 +1000)]
r300g: fix comparison of hyperz flush time.

I haven't confirmed this is doing the correct thing, but at
least this might make someone review it!

Reported by internal RH coverity scan.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Marek Olšák <maraeo@gmail.com>
12 years agodri_glx: fix use after free report
Dave Airlie [Fri, 30 Nov 2012 07:47:47 +0000 (17:47 +1000)]
dri_glx: fix use after free report

the critical error would use driverName.

Found by internal RH coverity scan.

Note: This is a candidate for stable branches.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agoRevert "glcpp: Rewrite line-continuation support to act globally."
Carl Worth [Sat, 1 Dec 2012 01:17:56 +0000 (17:17 -0800)]
Revert "glcpp: Rewrite line-continuation support to act globally."

This reverts commit 962a1c07b44fe500b79b3ca6806d72a432c1f055.

Further testing revealed that this commit can cause the pre-processor to enter
infinite loops. For now, simply revert this code until a cleaner,
better-tested version is available.

12 years agoglcpp: Rewrite line-continuation support to act globally.
Carl Worth [Thu, 29 Nov 2012 22:49:46 +0000 (14:49 -0800)]
glcpp: Rewrite line-continuation support to act globally.

Previously, we were only supporting line-continuation backslash characters
within lines of pre-processor directives, (as per the specification). With
OpenGL 4.2 and GLES3, line continuations are now supported anywhere within a
shader.

While changing this, also fix a bug where the preprocessor was ignoring
line continuation characters when a line ended in multiple backslash
characters.

The new code is also more efficient than the old. Previously, we would
perform a ralloc copy at each newline. We now perform copies only at each
occurrence of a line-continuation.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agoegl/wayland: Dispatch the event queue before get_buffers
Ander Conselvan de Oliveira [Thu, 22 Nov 2012 13:34:49 +0000 (15:34 +0200)]
egl/wayland: Dispatch the event queue before get_buffers

When a client frame callback is executed and the client starts rendering
again, the egl event queue might not have been dispatched so that the
buffer release event for the previous frame hasn't been processed. In
that case a third buffer is allocated, even though it would be possible
to reuse the buffer that was just released.

The wl_display_dispatch_queue_pending() entry point is available from
wayland-client 1.0.2, so require that in configure.ac.  Also, just
let the pkg-config macro throw its own error, which will show what version
we were looking for and failed to find.

Note: This is a candidate for stable branches.

Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
12 years agoegl/wayland: Add invalidate back in eglSwapBuffers()
Kristian Høgsberg [Fri, 30 Nov 2012 18:29:17 +0000 (13:29 -0500)]
egl/wayland: Add invalidate back in eglSwapBuffers()

Commit ca3ed3e024864e91ca3cccc59fb96950e1d079b5 fixed the problem where
eglMakeCurrent would trigger a getbuffer callback that then breaks the
following wl_egl_window_resize() call.  However, we still need to
invalidate buffers in eglSwapBuffers, since in wayland we always swap
buffers, so the dri driver needs to come out and ask us for the next buffer
after each swapbuffer.

Note: this is a candidate for stable branches.

Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
12 years agoi965/fs: Add fs_reg::is_zero() and is_one(); use for opt_algebraic().
Kenneth Graunke [Sat, 17 Nov 2012 23:10:53 +0000 (15:10 -0800)]
i965/fs: Add fs_reg::is_zero() and is_one(); use for opt_algebraic().

These helper macros save you from writing nasty expressions like:

   if ((inst->src[1].type == BRW_REGISTER_TYPE_F &&
         inst->src[1].imm.f == 1.0) ||
        ((inst->src[1].type == BRW_REGISTER_TYPE_D ||
          inst->src[1].type == BRW_REGISTER_TYPE_UD) &&
         inst->src[1].imm.u == 1)) {

Instead, you simply get to write inst->src[1].is_one().  Simple.
Also, this makes the FS backend match the VS backend (which has these).

This patch also converts opt_algebraic to use the new helper functions.
As a consequence, it will now also optimize integer-typed expressions.

Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agost/mesa: fix context use-after-free problem in st_renderbuffer_delete()
Brian Paul [Fri, 30 Nov 2012 17:11:54 +0000 (10:11 -0700)]
st/mesa: fix context use-after-free problem in st_renderbuffer_delete()

The use-after-free happened when the renderbuffer was shared by multiple
contexts and we tried to delete the renderbuffer using a context which
was previously deleted.

Note: this is a candidate for the stable branches.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
12 years agoutil: added pipe_surface_release() function
Brian Paul [Fri, 30 Nov 2012 17:10:25 +0000 (10:10 -0700)]
util: added pipe_surface_release() function

To fix a pipe_context::surface_destroy() use-after-free problem.
We previously added pipe_sampler_view_release() for similar reasons.

Note: this is a candidate for the stable branches.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
12 years agomesa: pass context parameter to gl_renderbuffer::Delete()
Brian Paul [Fri, 30 Nov 2012 17:04:48 +0000 (10:04 -0700)]
mesa: pass context parameter to gl_renderbuffer::Delete()

We sometimes need a rendering context when deleting renderbuffers.
Pass it explicitly instead of trying to grab a current context
(which might be NULL).  The next patch will make use of this.

Note: this is a candidate for the stable branches.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
12 years agoegl/wayland: Don't invalidate drawable on swap buffers
Ander Conselvan de Oliveira [Fri, 30 Nov 2012 15:41:02 +0000 (17:41 +0200)]
egl/wayland: Don't invalidate drawable on swap buffers

We used to invalidate the drawable after a call to eglSwapBuffers(),
so that a wl_egl_window_resize() would take effect for the next frame.
However, that leads to calling dri2_get_buffers() when eglMakeCurrent()
is called with the current context and surface, and a later call to
wl_egl_window_resize() would not take effect until the next buffer
swap.

Instead, add a callback from wl_egl_window_resize() back to the wayland
egl platform, and invalidate the drawable only when it is resized.

This solves a bug on wayland clients when going back to windowed mode
from fullscreen when clicking a pop up menu, where the window size
after this would be the fullscreen size.

Note: this is a candidate for stable branches.
CC: wayland-devel@lists.freedesktop.org