mesa.git
12 years agomesa: convert a few more macros to inline functions
Brian Paul [Sat, 25 Aug 2012 12:50:40 +0000 (06:50 -0600)]
mesa: convert a few more macros to inline functions

12 years agomesa: remove COPY_4V_CAST() macro
Brian Paul [Sat, 25 Aug 2012 12:43:37 +0000 (06:43 -0600)]
mesa: remove COPY_4V_CAST() macro

Only used in one place, and not really needed.

12 years agomesa: convert a bunch of math macros to inline functions
Brian Paul [Sat, 25 Aug 2012 12:33:16 +0000 (06:33 -0600)]
mesa: convert a bunch of math macros to inline functions

12 years agotnl: use INTERP_4F() instead of four INTERP_F() calls
Brian Paul [Sat, 25 Aug 2012 13:09:14 +0000 (07:09 -0600)]
tnl: use INTERP_4F() instead of four INTERP_F() calls

12 years agoswrast: fix wrong assignments in _swrast_add_spec_terms_line()
Brian Paul [Sat, 25 Aug 2012 13:08:10 +0000 (07:08 -0600)]
swrast: fix wrong assignments in _swrast_add_spec_terms_line()

12 years agomesa: test for GL_EXT_framebuffer_sRGB in glPopAttrib()
Brian Paul [Tue, 28 Aug 2012 03:52:07 +0000 (21:52 -0600)]
mesa: test for GL_EXT_framebuffer_sRGB in glPopAttrib()

To avoid spurious GL_INVALID_ENUM errors if the extension isn't supported.

12 years agomesa: Define CPU_TO_LE32 to work on OpenBSD
Martin Pieuchot [Wed, 29 Aug 2012 12:46:27 +0000 (14:46 +0200)]
mesa: Define CPU_TO_LE32 to work on OpenBSD

Signed-off-by: Brian Paul <brianp@vmware.com>
12 years agodocs: remove mention of old driver maintenance
Brian Paul [Tue, 28 Aug 2012 15:47:30 +0000 (09:47 -0600)]
docs: remove mention of old driver maintenance

People who need old drivers can use older versions of Mesa.

12 years agodocs/utilities: add/update some useful utilities
Andreas Boll [Tue, 28 Aug 2012 15:31:52 +0000 (17:31 +0200)]
docs/utilities: add/update some useful utilities

the progs/util directory is now in mesa demos
replace glean with piglit
add ApiTrace

markup: replace the unordered list <ul> with a definition list <dl>

Signed-off-by: Brian Paul <brianp@vmware.com>
12 years agoi965: Disable the swrast context setup on GL 3.1 core.
Eric Anholt [Sun, 26 Aug 2012 22:29:12 +0000 (15:29 -0700)]
i965: Disable the swrast context setup on GL 3.1 core.

I've reviewed the code, and the swrast callsites remaining are all in
drawpixels/copypixels/bitmap/accum, or _swrast_BlitFramebuffer that shouldn't
be hit.  A piglit run with the context setup disabled on legacy GL and GLES2
showed regressions only in the copypixels and drawpixels tests.

If the context type is forced, this reduces the shader_runner maximum heap
size for glsl-algebraic-add-add-1.shader_test from 15,137,496b to 4,165,376b.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
12 years agoi965: Replace general sw fallback support with a manual check for rendermode.
Eric Anholt [Sun, 26 Aug 2012 22:09:23 +0000 (15:09 -0700)]
i965: Replace general sw fallback support with a manual check for rendermode.

There were no other cases that set it any more.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agointel: Move RenderMode fallback func to i915 driver.
Eric Anholt [Sun, 26 Aug 2012 22:15:44 +0000 (15:15 -0700)]
intel: Move RenderMode fallback func to i915 driver.

The Fallback field of the context struct doesn't work that way on i965, and
it's the only caller of FALLBACK() in the driver.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agoi965: Drop the old sw fallback for position array being disabled.
Eric Anholt [Sun, 26 Aug 2012 22:11:49 +0000 (15:11 -0700)]
i965: Drop the old sw fallback for position array being disabled.

This code has been in the driver since the first commit.  I think it was
trying to stop rendering from happening with a disabled position array.  Core
mesa has since had changes to deal with disabled position arrays correctly.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agoi965: Drop support for forcing drawing through sw fallbacks.
Eric Anholt [Sun, 26 Aug 2012 22:07:03 +0000 (15:07 -0700)]
i965: Drop support for forcing drawing through sw fallbacks.

It turns out it hasn't worked since at least 8.0.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agoi965: Move depth resolve for span fallbacks to a simpler place.
Eric Anholt [Sun, 26 Aug 2012 21:43:52 +0000 (14:43 -0700)]
i965: Move depth resolve for span fallbacks to a simpler place.

Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Acked-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agoi965: Drop manual hiz resolves in span rendering.
Eric Anholt [Sun, 26 Aug 2012 21:36:57 +0000 (14:36 -0700)]
i965: Drop manual hiz resolves in span rendering.

swrast uses MapRenderbuffer, which leads to intel_miptree_map, which does the
depth resolve.

Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Acked-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agoradeon/llvm: Handle TGSI KIL opcode for SI.
Michel Dänzer [Tue, 28 Aug 2012 13:59:30 +0000 (15:59 +0200)]
radeon/llvm: Handle TGSI KIL opcode for SI.

Fixes piglit fp-kil and glBitmap() with radeonsi.

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
12 years agoradeon/llvm: Basic support for SI EXEC register.
Michel Dänzer [Tue, 28 Aug 2012 18:06:20 +0000 (20:06 +0200)]
radeon/llvm: Basic support for SI EXEC register.

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
12 years agoradeonsi: Don't write to the PA_SC_RASTER_CONFIG register.
Michel Dänzer [Fri, 24 Aug 2012 15:31:48 +0000 (17:31 +0200)]
radeonsi: Don't write to the PA_SC_RASTER_CONFIG register.

It should be initialized by the kernel as necessary.

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
12 years agor600g: fix relative addressing on RS780 and RS880
Marek Olšák [Mon, 27 Aug 2012 00:08:37 +0000 (02:08 +0200)]
r600g: fix relative addressing on RS780 and RS880

They should be treated like RV670.

Tested-by: Michel Dänzer <michel.daenzer@amd.com>
12 years agodocs/helpwanted: add radeonsi todo list
Andreas Boll [Tue, 28 Aug 2012 15:28:20 +0000 (17:28 +0200)]
docs/helpwanted: add radeonsi todo list

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
12 years agoconfigure.ac: add radeonsi to --with-gallium-drivers help string
Andreas Boll [Tue, 28 Aug 2012 15:28:19 +0000 (17:28 +0200)]
configure.ac: add radeonsi to --with-gallium-drivers help string

the help string is used by ./configure --help

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
12 years agollvmpipe: Bump the maximum texture size (in pixels).
José Fonseca [Fri, 6 Jul 2012 18:14:37 +0000 (19:14 +0100)]
llvmpipe: Bump the maximum texture size (in pixels).

But cap the size in bytes, to avoid depleting the whole system memory,
with humongus textures.

Tested with max-texture-size piglit test.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
12 years agou_vbuf: avoid unnecessary update of the vertex elements
Vadim Girlin [Tue, 28 Aug 2012 14:01:13 +0000 (18:01 +0400)]
u_vbuf: avoid unnecessary update of the vertex elements

Signed-off-by: Vadim Girlin <vadimgirlin@gmail.com>
Reviewed-by: Marek Olšák <maraeo@gmail.com>
12 years agoegl: fix invalid flag detection for EGL_KHR_create_context
Matt Turner [Fri, 24 Aug 2012 23:26:54 +0000 (16:26 -0700)]
egl: fix invalid flag detection for EGL_KHR_create_context

We want to check whether there are bits set outside of the valid flags.

Fixes piglit test egl-create-context-invalid-flag-gl

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agoi965: Make VS programs obey the shader_precompile driconf option.
Kenneth Graunke [Sun, 26 Aug 2012 19:17:29 +0000 (12:17 -0700)]
i965: Make VS programs obey the shader_precompile driconf option.

Now that it's on by default, we may as well make it obey the flag,
for consistency's sake if nothing else.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoi965: Reenable the fragment shader precompile.
Kenneth Graunke [Sun, 26 Aug 2012 19:11:50 +0000 (12:11 -0700)]
i965: Reenable the fragment shader precompile.

Precompiling the shader at link time often allows us to avoid compiling
it at the first use.  This moves the expensive compilation and
optimization process to game or level load time, rather than at draw
time, where we really can't avoid any cycles and don't want to risk
stalling the GPU.

The downside is that we have to guess the non-orthagonal state the
program will have set when it draws with the shader.  Previously, we
guessed wrong for nearly every shader, so it wasn't useful.  With the
recent SamplerUnits rework and this series, we've either eliminated
state or made smarter guesses, and usually get it right now.

In the L4D2 time demo, I now have 39 fragment shader recompiles and no
vertex shader recompiles.  Before this series and the SamplerUnits
rework, I had 206 fragment shader recompiles and 192 vertex shader
recompiles.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoi965: Set swizzle fields in the VS precompile program key.
Kenneth Graunke [Sun, 26 Aug 2012 18:45:49 +0000 (11:45 -0700)]
i965: Set swizzle fields in the VS precompile program key.

This fixes a regression since 76d1301e8e8e50dc962601a9977bc52148798349:
I began setting SWIZZLE_XYZW for unused sampler units in the actual
program keys, since this matched the FS precompile behavior.  However,
the VS precompile was expecting zero, so that commit made essentially
every vertex shader (even those not using texturing) mismatch and need
to be recompiled.

Setting them in the VS precompile key solves the issue.  It also is an
improvement over our old behavior: previously we guessed that vertex
shaders didn't use any textures at all.  Now we actually look to see if
the VS had any sampler uniforms and guess based on that.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoi965/vs: Add VS program key dumping to INTEL_DEBUG=perf.
Kenneth Graunke [Sun, 26 Aug 2012 14:41:50 +0000 (07:41 -0700)]
i965/vs: Add VS program key dumping to INTEL_DEBUG=perf.

Eric added support for WM key debugging.  This adds it for the VS.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoi965/fs: Assume shadow sampler swizzling is <X, X, X, 1>.
Kenneth Graunke [Sun, 26 Aug 2012 07:34:03 +0000 (00:34 -0700)]
i965/fs: Assume shadow sampler swizzling is <X, X, X, 1>.

Our previous assumption, SWIZZLE_XYZW, was completely bogus for depth
textures.  There are no Y, Z, or W components.

DEPTH_TEXTURE_MODE has three options:
- GL_LUMINANCE: <X, X, X, 1>
- GL_INTENSITY: <X, X, X, X>
- GL_ALPHA:     <0, 0, 0, X>

The default value is GL_LUMINANCE, and most applications don't seem to
alter DEPTH_TEXTURE_MODE.  Make that our precompile guess.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoi965: Index sampler program key data by linker-assigned index.
Kenneth Graunke [Sun, 26 Aug 2012 07:28:38 +0000 (00:28 -0700)]
i965: Index sampler program key data by linker-assigned index.

Now that most things are based on the linker-assigned index, it makes
sense to convert the arrays in the VS/WM program key as well.  It seems
silly to leave them indexed by texture unit.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoi965: Only set proj_attrib_mask for fixed function.
Kenneth Graunke [Tue, 14 Aug 2012 06:42:23 +0000 (23:42 -0700)]
i965: Only set proj_attrib_mask for fixed function.

brw_wm_prog_key's proj_attrib_mask field is designed to enable an
optimization for fixed-function programs, letting us avoid projecting
attributes where the divisor is 1.0.

However, for shaders, this is not useful, and is pretty much impossible
to guess when building the FS precompile key.  Turning it off for
shaders should allow the precompile to work and not lose much.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Suggested-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoi965: Don't set stats_wm in the WM program key on Gen6+.
Kenneth Graunke [Sun, 26 Aug 2012 07:47:44 +0000 (00:47 -0700)]
i965: Don't set stats_wm in the WM program key on Gen6+.

It's only needed for Gen4/5 IZ lookup workarounds.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoi965: Don't set vp_outputs_written in the WM program key on Gen6+.
Kenneth Graunke [Tue, 14 Aug 2012 06:59:09 +0000 (23:59 -0700)]
i965: Don't set vp_outputs_written in the WM program key on Gen6+.

It's only used by on pre-Sandybridge hardware.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoi965: Double the size of the state cache.
Kenneth Graunke [Sun, 26 Aug 2012 07:07:56 +0000 (00:07 -0700)]
i965: Double the size of the state cache.

We probably want to do something more sophisticated here, but this at
least makes it through L4D2 without dumping the program cache.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoglapi/glx: call __glEmptyImage if USE_XCB, not memcpy directly
Julien Cristau [Fri, 20 Jul 2012 09:09:19 +0000 (11:09 +0200)]
glapi/glx: call __glEmptyImage if USE_XCB, not memcpy directly

We were stomping on the caller's buffer by ignoring their alignment
requests and other pixel store modes.  This patch makes the USE_XCB path match
the older one more closely.

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

Signed-off-by: Julien Cristau <julien.cristau@logilab.fr>
Signed-off-by: Brian Paul <brianp@vmware.com>
12 years agogallium/util: implement tile code for PIPE_FORMAT_Z32_FLOAT
Brian Paul [Mon, 27 Aug 2012 15:31:18 +0000 (09:31 -0600)]
gallium/util: implement tile code for PIPE_FORMAT_Z32_FLOAT

Reviewed-by: José Fonseca <jfonseca@vmware.com>
12 years agost/mesa: use fallback path for glCopyTexSubImage(GL_TEXTURE_1D_ARRAY)
Brian Paul [Mon, 27 Aug 2012 15:31:18 +0000 (09:31 -0600)]
st/mesa: use fallback path for glCopyTexSubImage(GL_TEXTURE_1D_ARRAY)

Fixes many failing cases in piglit copyteximage test.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
12 years agoi965: Move hiz resolve to after renderbuffer resizing (v2)
Chad Versace [Tue, 14 Aug 2012 18:23:21 +0000 (11:23 -0700)]
i965: Move hiz resolve to after renderbuffer resizing (v2)

Do all pre-draw hiz resolves *after* the renderbuffers are resized by
intel_prepare_render. Otherwise, we may resolve buffers that are
immediately discarded afterwards.

Fixes the assertion failure below when resizing windows in KDE and under
some unknown circumstance in Chrome OS:
    intel_resolve_map.c:46: intel_resolve_map_set: Assertion
    `(*tail)->need == need' failed.

Also, remove the comment that "resolves must occur [...] before setting up
any hardware state". That was true when resolves were implemented with
meta-ops, but no longer with blorp.

v2:
  - Keep brw_predraw_resolve_buffers in its current position, which is
    before any brw_context bits are modified. Instead, move the call to
    intel_prepare_render.

Note: This is a candiate for the 8.0 branch.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=52252
Reported-by: Lu Hua <huax.lu@intel.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
12 years agoi965: Remove redundant null check
Chad Versace [Tue, 14 Aug 2012 18:28:27 +0000 (11:28 -0700)]
i965: Remove redundant null check

intel_renderbuffer_resolve_hiz checks if rb->mt is null, so there is no
need for the caller to do so.

Reviewed-by: Paul Berry <stereotype441@gmail.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
12 years agor300g: implement TRUNC correctly
Marek Olšák [Mon, 27 Aug 2012 05:38:15 +0000 (07:38 +0200)]
r300g: implement TRUNC correctly

This fixes some integer division tests.

12 years agoradeonsi: Use FP16 shader export format when necessary / possible.
Michel Dänzer [Wed, 22 Aug 2012 16:15:36 +0000 (18:15 +0200)]
radeonsi: Use FP16 shader export format when necessary / possible.

Fixes piglit fbo-blending-formats.

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
12 years agoradeonsi: Refactor initialization of shader export intrinsic arguments.
Michel Dänzer [Fri, 24 Aug 2012 10:03:11 +0000 (12:03 +0200)]
radeonsi: Refactor initialization of shader export intrinsic arguments.

In preparation for extending this code, which would make it rather unwieldy in
its current place.

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
12 years agoradeonsi: Maintain cache of pixel shader variants according to contxt state.
Michel Dänzer [Thu, 23 Aug 2012 15:10:37 +0000 (17:10 +0200)]
radeonsi: Maintain cache of pixel shader variants according to contxt state.

Mostly inspired by r600g commit 4acf71f01ea1edb253cd38cc059d4af1a2a40bf4
('r600g: cache shader variants instead of rebuilding v3').

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
12 years agoradeonsi: Drop extraneous semicolons from pm4 state macro definitions.
Michel Dänzer [Thu, 23 Aug 2012 15:55:51 +0000 (17:55 +0200)]
radeonsi: Drop extraneous semicolons from pm4 state macro definitions.

Could cause build failures if trying to use the macros in certain constructs.

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
12 years agor600g: implement compression for MSAA colorbuffers for evergreen
Marek Olšák [Sun, 12 Aug 2012 18:06:33 +0000 (20:06 +0200)]
r600g: implement compression for MSAA colorbuffers for evergreen

This adds the FMASK and CMASK buffers. They share the same resource
with color data.

COMPRESSION and FAST_CLEAR are always enabled if both FMASK and CMASK are
allocated. We initialize the CMASK to a "compressed" state (not "fast cleared"),
so that we can keep FAST_CLEAR enabled all the time.

Both FMASK and CMASK must be present at the moment. If either one is missing,
the other one is not used.

v2: add cayman regs in the list

Reviewed-by: Jerome Glisse <jglisse@redhat.com>
12 years agor600g: cleanup names around depth decompression
Marek Olšák [Mon, 13 Aug 2012 17:52:57 +0000 (19:52 +0200)]
r600g: cleanup names around depth decompression

for consistency with the upcoming color decompression naming

Reviewed-by: Jerome Glisse <jglisse@redhat.com>
12 years agor600g: fix evergreen 8x MSAA sample positions
Marek Olšák [Wed, 22 Aug 2012 22:39:01 +0000 (00:39 +0200)]
r600g: fix evergreen 8x MSAA sample positions

The original samples positions took samples outside of the pixel boundary,
leading to dark pixels on the edge of the colorbuffer, among other things.

Reviewed-by: Jerome Glisse <jglisse@redhat.com>
12 years agor600g: set CB_TARGET_MASK to 0xf and not 0xff for resolve on evergreen
Marek Olšák [Sat, 18 Aug 2012 23:38:07 +0000 (01:38 +0200)]
r600g: set CB_TARGET_MASK to 0xf and not 0xff for resolve on evergreen

independent_blend_enable must be true, so that the colormask isn't replicated
in all colorbuffers.

Reviewed-by: Jerome Glisse <jglisse@redhat.com>
12 years agogallium/u_blitter: initialize sample mask in resolve
Marek Olšák [Sat, 18 Aug 2012 18:39:35 +0000 (20:39 +0200)]
gallium/u_blitter: initialize sample mask in resolve

Reviewed-by: Jerome Glisse <jglisse@redhat.com>
12 years agor300/compiler: Use variable lists in the rename_regs pass
Tom Stellard [Sun, 24 Jun 2012 18:23:26 +0000 (14:23 -0400)]
r300/compiler: Use variable lists in the rename_regs pass

12 years agoi965: Rewrite the comment describing the query object support.
Eric Anholt [Thu, 23 Aug 2012 18:35:32 +0000 (11:35 -0700)]
i965: Rewrite the comment describing the query object support.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agoi965/gen6+: Add support for GL_ARB_timer_query.
Eric Anholt [Wed, 18 Jul 2012 17:18:26 +0000 (10:18 -0700)]
i965/gen6+: Add support for GL_ARB_timer_query.

Needs updated libdrm.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agoi965: Add support for GL_ARB_occlusion_query2.
Eric Anholt [Thu, 23 Aug 2012 16:56:31 +0000 (09:56 -0700)]
i965: Add support for GL_ARB_occlusion_query2.

This extension is just a bit of core code on top of the GL_ARB_occlusion_query
support.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agomesa: Add constants for the GL_QUERY_COUNTER_BITS per target.
Eric Anholt [Thu, 23 Aug 2012 17:18:47 +0000 (10:18 -0700)]
mesa: Add constants for the GL_QUERY_COUNTER_BITS per target.

Drivers need to be able to communicate their actual number of bits populated
in the field in order for applications to be able to properly handle rollover.

There's a small behavior change here: Instead of reporting the
GL_SAMPLES_PASSED bits for GL_ANY_SAMPLES_PASSED (which would also be valid),
just return 1, because more bits don't make any sense.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
12 years agoi965: Fix accumulator_contains() test to also reject swizzles of the dst.
Eric Anholt [Mon, 13 Aug 2012 06:30:18 +0000 (23:30 -0700)]
i965: Fix accumulator_contains() test to also reject swizzles of the dst.

When faced with this sequence:

MOV R1, c[1];
MAD R0, R2, R1.x, R1.y;

we were concluding that the MOV of R1 set up our accumulator and so we could
just use the previous result.  Only, it's got R1.xyzw in it instead of the
r1.y we're looking for.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=46784
NOTE: This is a candidate for the 8.0 branch.

12 years agost/dri: Support width and height getters
Jakob Bornecrantz [Wed, 15 Aug 2012 10:42:19 +0000 (12:42 +0200)]
st/dri: Support width and height getters

Tested-by: Scott Moreau <oreaus@gmail.com>
Signed-off-by: Jakob Bornecrantz <jakob@vmware.com>
12 years agost/dri: Claim to support validate_usage
Jakob Bornecrantz [Tue, 21 Aug 2012 21:19:32 +0000 (23:19 +0200)]
st/dri: Claim to support validate_usage

Support version 3 as well as 2, since that is only the new format query,
which Jesse added support for to st/dri when he added it to dri_inteface.h.

Tested-by: Scott Moreau <oreaus@gmail.com>
Signed-off-by: Jakob Bornecrantz <jakob@vmware.com>
12 years agodri: Make query image WIDTH and HEIGHT be version 4
Jakob Bornecrantz [Tue, 21 Aug 2012 16:01:55 +0000 (18:01 +0200)]
dri: Make query image WIDTH and HEIGHT be version 4

Tested-by: Scott Moreau <oreaus@gmail.com>
Signed-off-by: Jakob Bornecrantz <jakob@vmware.com>
12 years agodri: Remove image write function
Jakob Bornecrantz [Wed, 15 Aug 2012 09:37:18 +0000 (11:37 +0200)]
dri: Remove image write function

Since its not used by anything anymore and no release has gone out
where it was being used.

Tested-by: Scott Moreau <oreaus@gmail.com>
Signed-off-by: Jakob Bornecrantz <jakob@vmware.com>
12 years agogbm: Use libkms to replace DRI cursor images
Jakob Bornecrantz [Mon, 13 Aug 2012 13:55:23 +0000 (15:55 +0200)]
gbm: Use libkms to replace DRI cursor images

Uses libkms instead of dri image cursor. Since this is the only user of the
DRI cursor and write interface we can remove cursor surfaces entirely from
the DRI interface and as a consequence also from the Gallium interface as
well. Tho to make everybody happy with this it would probably should add a
kms_bo_write function, but that is probably wise in anyways.

The only downside is that it adds a dependancy on libkms, this could how ever
be replaced with the dumb_bo drm ioctl interface.

Tested-by: Scott Moreau <oreaus@gmail.com>
Signed-off-by: Jakob Bornecrantz <jakob@vmware.com>
12 years agoi965: Don't set iz_lookup the FS precompile's program key on Gen6+.
Kenneth Graunke [Tue, 14 Aug 2012 06:59:51 +0000 (23:59 -0700)]
i965: Don't set iz_lookup the FS precompile's program key on Gen6+.

We already changed the actual program key builder to only set these bits
on gen < 6; this patch just brings the precompile state back in line so
it doesn't mismatch every time.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoi965/fs: Fix INTEL_DEBUG=perf program key printing.
Kenneth Graunke [Wed, 15 Aug 2012 23:35:35 +0000 (16:35 -0700)]
i965/fs: Fix INTEL_DEBUG=perf program key printing.

When dumping differences in program keys, it printed messages of the
format:

   [Name of thing that changed]  [new]->[old]

This was terribly confusing: the right arrow implies "the value changed
from this to that", when in fact the message conveyed the opposite.

Except that some of the time, it didn't, since we accidentally swapped
the arguments to brw_debug_recompile_sampler_key.  With two swaps, it
would often come out in the expected format.

This patch fixes it to properly print:

   [Name of thing that changed]  [old]->[new]

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agomesa: Use a new, more specific hook for shader uniform changes.
Kenneth Graunke [Wed, 22 Aug 2012 07:43:14 +0000 (00:43 -0700)]
mesa: Use a new, more specific hook for shader uniform changes.

Gallium drivers and i965 don't require special notification when
sampler uniforms change.  They simply see the _NEW_TEXTURE and adjust
their indirection tables.  These drivers don't want ProgramStringNotify:
it simply causes pointless recompiles.

Unfortunately, i915 still requires shader recompiles and needs
ProgramStringNotify.  Rather than trying to fix that, simply change the
hook to a new, more specific one: ShaderUniformChange.  On i915, this
translates to ProgramStringNotify; others simply ignore it.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoi965: Use linker-assigned sampler IDs in instruction encoding.
Kenneth Graunke [Fri, 24 Aug 2012 08:22:58 +0000 (01:22 -0700)]
i965: Use linker-assigned sampler IDs in instruction encoding.

When assigning uniform locations, the linker assigns each sampler
uniform a sequential numerical ID.  gl_shader_program::SamplerUnits maps
these sampler variable IDs to the actual texture units they reference
(specified via glUniform1i).

Previously, we encoded this mapping in the SEND instruction encoding:
the "sampler" was the texture unit number, and the binding table index
was SURF_INDEX_TEXTURE(the texture unit number).  This unfortunately
meant that whenever the application changed the value of a sampler
uniform, we had to recompile the shader to change the SEND instructions.

This was horrible for the game Cogs, which repeatedly switches between
using texture unit 0 and 1.  It also made fragment shader precompiles
useless: we'd do the precompile at glLinkShader() time, before the
application called glUniform1i to set the sampler values.  As soon as
it did that, we'd have to recompile, wasting time and space in the
program cache.

This patch encodes the SamplerUnits indirection in the binding table,
sampler state, and sampler default color tables.  Instead of baking the
texture unit number into the shader, we bake in the sampler variable ID
assigned by the linker.  Since those never change, we don't need to
recompile programs on uniform changes.

This does mean that the tables now depend on the linked shader program
being used for rendering, rather than simply representing all available
texture units.  This could cause an increase in state emission.

Another plus is that the sampler state and sampler default color tables
are now compact: we only emit as many entries as there are sampler
uniforms, with no holes in the table since the new sampler IDs are
sequential.  Previously we had to emit a full 16 entries every time,
since the tables tracked the state of all active texture units.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoi965: Add a "sampler state index" parameter to update_sampler_state().
Kenneth Graunke [Fri, 24 Aug 2012 08:12:53 +0000 (01:12 -0700)]
i965: Add a "sampler state index" parameter to update_sampler_state().

This represents the index into the sampler state table or sampler
default color table (the two are identical).

Right now, this is still the texture unit, but that will change shortly.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoi965: Un-hardcode WM binding table from update_texture_surface.
Kenneth Graunke [Tue, 14 Aug 2012 22:45:52 +0000 (15:45 -0700)]
i965: Un-hardcode WM binding table from update_texture_surface.

Currently, we mirror the VS and WM binding tables' texture entries.
That may not continue to be true, so in preparation, pass in the binding
table and surface index as arguments.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoi965/vs: Rename "sampler" to "texunit" in texturing code.
Kenneth Graunke [Tue, 21 Aug 2012 19:16:46 +0000 (12:16 -0700)]
i965/vs: Rename "sampler" to "texunit" in texturing code.

The number we're passing around is actually the ID of the texture unit,
as opposed to the numerical value our of sampler uniforms.  Calling it
"texunit" clarifies this slightly.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoi965/fs: Rename "sampler" to "texunit" in texturing code.
Kenneth Graunke [Tue, 21 Aug 2012 18:41:07 +0000 (11:41 -0700)]
i965/fs: Rename "sampler" to "texunit" in texturing code.

The number we're passing around is actually the ID of the texture unit,
as opposed to the numerical value our of sampler uniforms.  Calling it
"texunit" clarifies this slightly.

Don't bother renaming fs_instruction::sampler.  Although it's currently
the texture unit, this series will change that.  No need for the churn.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoi965/fs: Remove unused 'sampler' parameter in emit_texture_genX().
Kenneth Graunke [Tue, 21 Aug 2012 18:45:09 +0000 (11:45 -0700)]
i965/fs: Remove unused 'sampler' parameter in emit_texture_genX().

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoi965: Set SWIZZLE_NOOP for unused texture units in the program keys.
Kenneth Graunke [Tue, 14 Aug 2012 18:05:55 +0000 (11:05 -0700)]
i965: Set SWIZZLE_NOOP for unused texture units in the program keys.

Previously, we left the swizzle key field as zero for unused texture
units.  The precompile sets all of them to SWIZZLE_NOOP, which meant
that we mismatched almost every time.

Since either works equally well, change it to SWIZZLE_NOOP to match
the precompiles.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoi965: Remove four and a half year old TODO comments about samplers.
Kenneth Graunke [Wed, 22 Aug 2012 06:25:50 +0000 (23:25 -0700)]
i965: Remove four and a half year old TODO comments about samplers.

I can't actually understand what these mean, and they seem to
essentially say "we should simplify things", which is a nice goal but
not very specific.

Presumably things got cleaned up at some point.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoi965: Fix brw_link_shader to return false rather than NULL.
Kenneth Graunke [Tue, 21 Aug 2012 18:39:49 +0000 (11:39 -0700)]
i965: Fix brw_link_shader to return false rather than NULL.

Fixes brw_shader.cpp:101:9: warning: converting to non-pointer type
'GLboolean {aka unsigned char}' from NULL [-Wconversion-null]

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-with-great-enthusiasm-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by Eric Anholt <eric@anholt.net>

12 years agomesa/es: Validate glGetBufferParameteriv pname in Mesa code rather than the ES wrapper
Ian Romanick [Fri, 27 Jul 2012 14:16:41 +0000 (07:16 -0700)]
mesa/es: Validate glGetBufferParameteriv pname in Mesa code rather than the ES wrapper

v2: Add proper core-profile and GLES3 filtering.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agomesa/es: Validate glMapBuffer access in Mesa code rather than the ES wrapper
Ian Romanick [Wed, 25 Jul 2012 23:17:25 +0000 (16:17 -0700)]
mesa/es: Validate glMapBuffer access in Mesa code rather than the ES wrapper

v2: Add proper core-profile and GLES3 filtering.

v3: *Really* add proper core-profile and GLES3 filtering based on review
feedback from Eric Anholt.  It looks like previously there was some
rebase / merge fail.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agomesa/es: Validate glBufferData usage in Mesa code rather than the ES wrapper
Ian Romanick [Wed, 25 Jul 2012 23:08:12 +0000 (16:08 -0700)]
mesa/es: Validate glBufferData usage in Mesa code rather than the ES wrapper

v2: Add proper core-profile and GLES3 filtering based on review feedback
from Eric Anholt.  It looks like previously there was some rebase /
merge fail.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agomesa/es: Validate buffer object targets in Mesa code rather than the ES wrapper
Ian Romanick [Wed, 25 Jul 2012 22:29:48 +0000 (15:29 -0700)]
mesa/es: Validate buffer object targets in Mesa code rather than the ES wrapper

v2: Add proper core-profile and GLES3 filtering.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agomesa/es: Validate VertexPointer types in Mesa code rather than the ES wrapper
Ian Romanick [Wed, 25 Jul 2012 22:19:31 +0000 (15:19 -0700)]
mesa/es: Validate VertexPointer types in Mesa code rather than the ES wrapper

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agomesa/es: Remove redundant vertex pointer size validation
Ian Romanick [Wed, 25 Jul 2012 22:15:11 +0000 (15:15 -0700)]
mesa/es: Remove redundant vertex pointer size validation

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agomesa/es: Validate TexCoordPointer size in Mesa code rather than the ES wrapper
Ian Romanick [Wed, 25 Jul 2012 22:13:51 +0000 (15:13 -0700)]
mesa/es: Validate TexCoordPointer size in Mesa code rather than the ES wrapper

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agomesa/es: Validate TexCoordPointer types in Mesa code rather than the ES wrapper
Ian Romanick [Wed, 25 Jul 2012 22:13:00 +0000 (15:13 -0700)]
mesa/es: Validate TexCoordPointer types in Mesa code rather than the ES wrapper

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agomesa/es: Validate NormalPointer types in Mesa code rather than the ES wrapper
Ian Romanick [Wed, 25 Jul 2012 22:10:21 +0000 (15:10 -0700)]
mesa/es: Validate NormalPointer types in Mesa code rather than the ES wrapper

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agomesa/es: Validate ColorPointer size in Mesa code rather than the ES wrapper
Ian Romanick [Wed, 25 Jul 2012 21:58:36 +0000 (14:58 -0700)]
mesa/es: Validate ColorPointer size in Mesa code rather than the ES wrapper

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agomesa/es: Validate ColorPointer types in Mesa code rather than the ES wrapper
Ian Romanick [Wed, 25 Jul 2012 21:53:01 +0000 (14:53 -0700)]
mesa/es: Validate ColorPointer types in Mesa code rather than the ES wrapper

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agomesa/es: Remove redundant vertex attrib pointer type validation
Ian Romanick [Wed, 25 Jul 2012 21:48:17 +0000 (14:48 -0700)]
mesa/es: Remove redundant vertex attrib pointer type validation

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agomesa/es: Remove redundant vertex attrib pointer size validation
Ian Romanick [Wed, 25 Jul 2012 21:34:53 +0000 (14:34 -0700)]
mesa/es: Remove redundant vertex attrib pointer size validation

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agomesa/es: Disallow BGRA vertex arrays in ES or ES2 contexts
Ian Romanick [Wed, 25 Jul 2012 21:46:54 +0000 (14:46 -0700)]
mesa/es: Disallow BGRA vertex arrays in ES or ES2 contexts

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agomesa: Rearrange array type checking, filter more types in ES
Ian Romanick [Wed, 25 Jul 2012 21:40:18 +0000 (14:40 -0700)]
mesa: Rearrange array type checking, filter more types in ES

v2: Fix handling of GL_INT and GL_UNSIGNED_INT types pre-ES3.0, and fix
handling of GL_INT_2_10_10_10_REV and GL_UNSIGNED_INT_2_10_10_10_REV in
ES3.0.  Based on review comments by Ken Graunke.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
12 years agomesa: Refactor element type checking into its own function
Ian Romanick [Wed, 25 Jul 2012 14:24:58 +0000 (07:24 -0700)]
mesa: Refactor element type checking into its own function

This consolidates the tests and makes the emitted error message
consistent.

v2: Rename _mesa_valid_element_type to valid_elements_type.  Log the
enum string instead of the hex value in error messages.  Based on review
comments from Brian Paul and Ken Graunke.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
12 years agowgl: update some comments
Brian Paul [Fri, 24 Aug 2012 17:45:05 +0000 (11:45 -0600)]
wgl: update some comments

12 years agost/mesa: don't do (generic) compression of 1D or 1D_ARRAY textures
Brian Paul [Fri, 24 Aug 2012 14:44:47 +0000 (08:44 -0600)]
st/mesa: don't do (generic) compression of 1D or 1D_ARRAY textures

As with the previous commit for core Mesa.

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
12 years agomesa: add generic compressed -> uncompressed format helper
Brian Paul [Fri, 24 Aug 2012 14:43:42 +0000 (08:43 -0600)]
mesa: add generic compressed -> uncompressed format helper

_mesa_generic_compressed_format_to_uncompressed_format() probably wins the
prize for longest function name in Mesa.

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
12 years agomesa: don't try (generic) compression of 1D and 1D_ARRAY textures
Brian Paul [Fri, 24 Aug 2012 14:38:46 +0000 (08:38 -0600)]
mesa: don't try (generic) compression of 1D and 1D_ARRAY textures

See comments in the code for details.

Note: we only need to special-case the generic compressed formats since
specific texture formats are error-checked earlier to see if the compression
format is compatible with the texture type.

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
12 years agomesa: add texture target field to ChooseTextureFormat() driver hook
Brian Paul [Fri, 24 Aug 2012 14:31:37 +0000 (08:31 -0600)]
mesa: add texture target field to ChooseTextureFormat() driver hook

This will let us choose the actual hardware format depending on the
type of texture.

v2: fixup radeon, nouveau, intel and swrast drivers too

Reviewed-by: Eric Anholt <eric@anholt.net>
12 years agoxlib: remove texture compression hackery
Brian Paul [Fri, 24 Aug 2012 14:37:40 +0000 (08:37 -0600)]
xlib: remove texture compression hackery

I think this was left-over debug code from long ago.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agost/mesa: clean up use of 'target' variable in st_context_teximage()
Brian Paul [Fri, 24 Aug 2012 13:20:58 +0000 (07:20 -0600)]
st/mesa: clean up use of 'target' variable in st_context_teximage()

'target' was used both as a parameter of type st_texture_type and then
re-used for GL_TEXTURE_x targets.  Rename the function parameter and
add a new local 'GLenum target'.

And remove an extraneous break statement.

12 years agoautomake: convert vgapi
Matt Turner [Wed, 22 Aug 2012 23:57:38 +0000 (16:57 -0700)]
automake: convert vgapi

12 years agobuild: Check for bison-generated file before bailing because of no bison
Matt Turner [Wed, 22 Aug 2012 22:08:01 +0000 (15:08 -0700)]
build: Check for bison-generated file before bailing because of no bison

.y/.c was a typo.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
12 years agoMove _mesa_dl* functions into dlopen.h and inline them
Matt Turner [Wed, 22 Aug 2012 19:45:48 +0000 (12:45 -0700)]
Move _mesa_dl* functions into dlopen.h and inline them

No point in having an extra function call for inlinable functions.

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
12 years agomesa/dlopen: use HAVE_DLOPEN instead of _GNU_SOURCE
Tapani Pälli [Thu, 16 Aug 2012 10:59:12 +0000 (13:59 +0300)]
mesa/dlopen: use HAVE_DLOPEN instead of _GNU_SOURCE

Patches changes mesa to use 'HAVE_DLOPEN' defined by configure and Android.mk
instead of _GNU_SOURCE for detecting dlopen capability. This makes dlopen to
work also on Android where _GNU_SOURCE is not defined.

[mattst88] v2: HAVE_DLOPEN is sufficient for including dlfcn.h, remove
       mingw/blrts checks around dlfcn.h inclusion.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Tapani Pälli <tapani.palli@intel.com>