mesa.git
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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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.

12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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

12 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

12 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

12 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.

12 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.

12 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>
12 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

12 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

12 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

12 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

12 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

12 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

12 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

12 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>
12 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
12 years agoegl: Only enable GLX backend if X11 EGL platform is enabled
Kristian Høgsberg [Thu, 29 Nov 2012 20:11:13 +0000 (15:11 -0500)]
egl: Only enable GLX backend if X11 EGL platform is enabled

We don't want to compile in a bunch of X11 dependencies in libEGL if
we can't run EGL on X11.

12 years agollvmpipe: Remove remnants of lp_tile_soa from Makefile.
José Fonseca [Fri, 30 Nov 2012 07:05:24 +0000 (07:05 +0000)]
llvmpipe: Remove remnants of lp_tile_soa from Makefile.

Completely forgot about updating Makefile when removing it. Stephane
already fixed the make build, but there were a few mentions of
lp_tile_soa left in the tree.

12 years agoi965/fp: Fix segfault on gen4 TXB instructions.
Eric Anholt [Mon, 26 Nov 2012 21:39:11 +0000 (13:39 -0800)]
i965/fp: Fix segfault on gen4 TXB instructions.

The gen4 simd16 workaround looks at ir->type to determine how much
storage to allocate for the simd16 value.  In fragment programs,
texturing only ever returns float vec4s (unlike GLSL, which can also
have scalar floats or vector integers), so this is the right type.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=56962
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agollvmpipe: Fix incorrect sizeof.
Vinson Lee [Thu, 29 Nov 2012 06:36:30 +0000 (22:36 -0800)]
llvmpipe: Fix incorrect sizeof.

Fixes sizeof not portable defects reported by Coverity.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
12 years agollvmpipe: Fix build break from 75da95c50
Stéphane Marchesin [Fri, 30 Nov 2012 03:49:44 +0000 (19:49 -0800)]
llvmpipe: Fix build break from 75da95c50

The Makefile looks for a file which is gone (lp_tile_soa.c)

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

12 years agomesa: Fix GL_LUMINANCE handling for textures in glGetTexImage
Anuj Phogat [Fri, 16 Nov 2012 18:47:56 +0000 (10:47 -0800)]
mesa: Fix GL_LUMINANCE handling for textures in glGetTexImage

We need to rebase colors (ex: set G=B=0) when getting GL_LUMINANCE
textures in following cases:
1. If the luminance texture is actually stored as rgba
2. If getting a luminance texture, but returning rgba
3. If getting an rgba texture, but returning luminance

A similar fix was pushed by Brian Paul for uncompressed textures
in commit: f5d0ced.
Fixes https://bugs.freedesktop.org/show_bug.cgi?id=47220

Observed no regressions in piglit and ogles2conform due to this fix.
This patch will cause failures in intel oglconform pxconv-gettex,
pxstore-gettex and pxtrans-gettex test cases. The cause of failures
is a bug in test cases. Expected luminance value is calculted
incorrectly in test cases: L = R+G+B.

V2: Set G = 0 when getting a RG texture but returning luminance.

Note: This is a candidate for stable branches.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Ian Romanick <idr@freedesktop.org>
12 years agoRevert "meta: Don't try to glOrtho when the draw buffer isn't initialized."
Kenneth Graunke [Thu, 29 Nov 2012 21:47:13 +0000 (13:47 -0800)]
Revert "meta: Don't try to glOrtho when the draw buffer isn't initialized."

This reverts commit 9947470655bbf8f4a9c98fe6d93ff5c3486f1124.
Apparently it caused a lot of Piglit regressions.

12 years agor600g: mirror simplification of if/break opcodes
Vincent Lejeune [Wed, 28 Nov 2012 18:59:07 +0000 (19:59 +0100)]
r600g: mirror simplification of if/break opcodes

Reviewed-by: Tom Stellard <thomas.stellard at amd.com>
12 years agor600g: separate resource_id and sampler_id tex info in tgsi-to-llvm
Vincent Lejeune [Tue, 20 Nov 2012 22:22:47 +0000 (23:22 +0100)]
r600g: separate resource_id and sampler_id tex info in tgsi-to-llvm

Reviewed-by: Tom Stellard <thomas.stellard at amd.com>
12 years agoglcpp: Update README for new support of __LINE__ and __FILE__.
Carl Worth [Thu, 29 Nov 2012 05:43:45 +0000 (21:43 -0800)]
glcpp: Update README for new support of __LINE__ and __FILE__.

Drop these from the known limitations list since support was recently added
for these.

Also, fix a typo while in the area, (and the oddly missing final newline).

Reviewed-by: Matt Turner <mattst88@gmail.com>
12 years agoglcpp: Add test involving token pasting of INTEGER tokens.
Carl Worth [Thu, 29 Nov 2012 01:32:03 +0000 (17:32 -0800)]
glcpp: Add test involving token pasting of INTEGER tokens.

This test file is very similar to test 113-line-and-file-macros but uses token
pasting for cleaner quiz answers (without spaces between the digits). This
test passes thanks to the recent addition of support for pasting INTEGER
tokens, (but would have failed without that).

(Note that this test is distinct from test 059-token-pasting-integer which
pastes integers parsed from the source. Those are parsed to INTEGER_STRING
tokens and are already pasted correctly as verified by that test. The only way
to generate the INTEGER tokens which currently fail to paste is with an
internal define such as __LINE__ that results in an integer.)

Reviewed-by: Matt Turner <mattst88@gmail.com>
12 years agoglcpp: Add support for pasting of INTEGER tokens.
Carl Worth [Thu, 29 Nov 2012 01:34:36 +0000 (17:34 -0800)]
glcpp: Add support for pasting of INTEGER tokens.

By generalizing the current code designed to paste string tokens of various
types.

Reviewed-by: Matt Turner <mattst88@gmail.com>
12 years agoglcpp: Flag invalid pastes for integer followed by non-digits
Carl Worth [Wed, 28 Nov 2012 21:01:24 +0000 (13:01 -0800)]
glcpp: Flag invalid pastes for integer followed by non-digits

As recently tested in the additions to the invalid paste test, it is illegal
to paste a non-digit sequence onto the end of an integer.

The 082-invalid-paste test should now pass again.

Reviewed-by: Matt Turner <mattst88@gmail.com>
12 years agoglcpp: Extend the invalid-paste test
Carl Worth [Wed, 28 Nov 2012 20:57:09 +0000 (12:57 -0800)]
glcpp: Extend the invalid-paste test

The current code lets a few invalid pastes through, such as an string pasted
onto the end of an integer. Extend the invalid-paste test to catch some of
these.

Reviewed-by: Matt Turner <mattst88@gmail.com>
12 years agoglcpp: More factoring-out of common code to simplify things.
Carl Worth [Wed, 28 Nov 2012 20:11:02 +0000 (12:11 -0800)]
glcpp: More factoring-out of common code to simplify things.

This time creating a new _token_list_create_with_one_integer function
modeled after the existing _token_list_create_with_one_space function
(both implemented with new _token_list_create_with_one_ival).

Reviewed-by: Matt Turner <mattst88@gmail.com>
12 years agoglcpp: Factor out a tiny bit of repeated code.
Carl Worth [Wed, 28 Nov 2012 20:03:50 +0000 (12:03 -0800)]
glcpp: Factor out a tiny bit of repeated code.

This function is getting a little long too read. Simplify it by pulling
up one assignment from every condition.

Reviewed-by: Matt Turner <mattst88@gmail.com>
12 years agoglcpp: Add support for __LINE__ and __FILE__ macros
Carl Worth [Wed, 28 Nov 2012 19:52:05 +0000 (11:52 -0800)]
glcpp: Add support for __LINE__ and __FILE__ macros

These tokens are easy to expand by just looking at the current, tracked
location values, (and no need to look anything up in the hash table).

Add a test which verifies __LINE__ with several values, (and verifies __FILE__
for the single value of 0). Our testing framework isn't sophisticated enough
here to have a test with multiple file inputs.

This commit fixes part of es3conform's preprocess16_frag test.

Reviewed-by: Matt Turner <mattst88@gmail.com>
12 years agomesa: Rename API_OPENGL to API_OPENGL_COMPAT.
Paul Berry [Tue, 27 Nov 2012 20:26:51 +0000 (12:26 -0800)]
mesa: Rename API_OPENGL to API_OPENGL_COMPAT.

This should help avoid confusion now that we're using the gl_api enum
to distinguishing between core and compatibility API's.  The
corresponding enum value for core API's is API_OPENGL_CORE.

Acked-by: Eric Anholt <eric@anholt.net>
Acked-by: Matt Turner <mattst88@gmail.com>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agogallium/postprocess: share pipe_context and cso_context with the state tracker
Marek Olšák [Thu, 29 Nov 2012 01:55:01 +0000 (02:55 +0100)]
gallium/postprocess: share pipe_context and cso_context with the state tracker

Using one context instead of two is more efficient and
we can skip another context flush.

Reviewed-by: Brian Paul <brianp@vmware.com>
12 years agomesa: move some helper functions from fboobject.c to glformats.c
Marek Olšák [Wed, 28 Nov 2012 18:07:18 +0000 (19:07 +0100)]
mesa: move some helper functions from fboobject.c to glformats.c

Reviewed-by: Brian Paul <brianp@vmware.com>
12 years agoandroid: include api_exec.c in generated files list
Tapani Pälli [Thu, 29 Nov 2012 07:48:00 +0000 (09:48 +0200)]
android: include api_exec.c in generated files list

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
12 years agogallivm: Fix lp_build_float_to_half.
José Fonseca [Thu, 29 Nov 2012 16:52:06 +0000 (16:52 +0000)]
gallivm: Fix lp_build_float_to_half.

The current implementation was close by not fully correct: several
operations that should be done in floating point were being done in
integer.

Fixes piglit fbo-clear-formats GL_ARB_texture_float

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
12 years agogallivm: fix a trivial txq issue for 2d shadow and cube shadow samplers
Roland Scheidegger [Thu, 29 Nov 2012 03:00:35 +0000 (04:00 +0100)]
gallivm: fix a trivial txq issue for 2d shadow and cube shadow samplers

untested (couldn't get the piglit test to run even with version overrides)
but seemed blatantly wrong.
In any case it would only affect an error case which when it would happen
probably all hope is lost anyway.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
12 years agollvmpipe: support array textures
Roland Scheidegger [Thu, 29 Nov 2012 03:08:32 +0000 (04:08 +0100)]
llvmpipe: support array textures

This adds array (1d,2d) texture support to llvmpipe.
Though probably should do something about 1d array textures requiring gobs
of memory (this issue is not strictly limited to arrays but it is probably
worse there).
Initial code by Jakob Bornecrantz <jakob@vmware.com>

Reviewed-by: José Fonseca <jfonseca@vmware.com>