mesa.git
10 years agoglsl: Add support for `precise` redeclarations
Chris Forbes [Sun, 27 Apr 2014 04:03:54 +0000 (16:03 +1200)]
glsl: Add support for `precise` redeclarations

This works like glsl-1.20+'s invariant redeclarations, but with fewer
restrictions, since `precise` is allowed on pretty much anything.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
10 years agoglsl: add support for `precise` in type_qualifier
Chris Forbes [Sun, 27 Apr 2014 04:03:53 +0000 (16:03 +1200)]
glsl: add support for `precise` in type_qualifier

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
10 years agoglsl: remove outdated comment, move sample to correct block
Chris Forbes [Sun, 27 Apr 2014 04:03:52 +0000 (16:03 +1200)]
glsl: remove outdated comment, move sample to correct block

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
10 years agoi965: Fix copy and pasted values in Broadwell code.
Kenneth Graunke [Tue, 13 May 2014 14:20:02 +0000 (07:20 -0700)]
i965: Fix copy and pasted values in Broadwell code.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Cc: "10.2" <mesa-stable@lists.freedesktop.org>
10 years agoglsl: Make most ir_instruction::as_subclass() functions non-virtual.
Matt Turner [Sat, 31 May 2014 02:26:30 +0000 (19:26 -0700)]
glsl: Make most ir_instruction::as_subclass() functions non-virtual.

There are several common ways to check whether an object is a particular
subclass: dynamic_cast<>, the as_subclass() pattern, or explicit enum
tags.  We originally used the virtual as_subclass methods, but later
added enum tags as they are much nicer for debugging.

Since we have the enum tags, we don't necessarily need to use virtual
functions to implement the as_subclass() methods.  We can just check the
tag and return the pointer or NULL.

This saves 18 entries in the vtable, and instead of two pointer
dereferences per as_subclass() call most are only three inline
instructions.

Compile time of sam3/112.frag (the longest compile in a recent shader-db
run) is reduced by 5% from 348 to 329 ms (n=500).

perf stat of this workload shows:
   24.14% reduction in iTLB-loads:       285,543 -> 216,606
   42.55% reduction in iTLB-load-misses:  18,785 ->  10,792

Reviewed-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
10 years agoglsl: Move ir_type_unset to end of enumeration.
Matt Turner [Sat, 31 May 2014 23:27:20 +0000 (16:27 -0700)]
glsl: Move ir_type_unset to end of enumeration.

Now that the constructors set a type, ir_type_unset is not very useful.
Move it to the end of the enum (specifically out of position 0) so that
enums checks for dereferences and rvalues can save an instruction.

Reviewed-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
10 years agoglsl: Reorder ir_type_* enum for easier comparisons.
Matt Turner [Sat, 31 May 2014 18:20:37 +0000 (11:20 -0700)]
glsl: Reorder ir_type_* enum for easier comparisons.

Makes checking whether an object is an ir_dereference, an ir_rvalue, or
an ir_jump simpler. Since ir_dereference is a subclass or ir_rvalue,
list its subtypes first so that they can both generate nice code.

Reviewed-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
10 years agoglsl: Remove useless call to as_rvalue().
Matt Turner [Sun, 1 Jun 2014 18:43:15 +0000 (11:43 -0700)]
glsl: Remove useless call to as_rvalue().

The type returned by hir() is already an ir_rvalue pointer.

Reviewed-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
10 years agoglsl: Set ir_instruction::ir_type in the base class constructor
Ian Romanick [Wed, 28 May 2014 02:49:04 +0000 (19:49 -0700)]
glsl: Set ir_instruction::ir_type in the base class constructor

This has the added perk that if you forget to set ir_type in the
constructor of a new subclass (or a new constructor of an existing
subclass) the compiler will tell you... instead of relying on
ir_validate or similar run-time detection.

Reviewed-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoegl: Check for NULL native_window in eglCreateWindowSurface
Sinclair Yeh [Tue, 3 Jun 2014 21:00:13 +0000 (14:00 -0700)]
egl: Check for NULL native_window in eglCreateWindowSurface

We have customers using NULL as a way to test the robustness of the API.
Without this check, EGL will segfault trying to dereference
dri2_surf->wl_win->private because wl_win is NULL.

This fix adds a check and sets EGL_BAD_NATIVE_WINDOW

v2: Incorporated feedback from idr - moved the check to a higher level
function.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Cc: "10.1 10.2" <mesa-stable@lists.freedesktop.org>
10 years agor600g,radeonsi: don't use hardware MSAA resolve if dst is fast-cleared
Marek Olšák [Mon, 2 Jun 2014 11:51:29 +0000 (13:51 +0200)]
r600g,radeonsi: don't use hardware MSAA resolve if dst is fast-cleared

It doesn't work and our docs say so too.

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
10 years agoradeonsi: BlitFramebuffer should follow render condition
Marek Olšák [Mon, 2 Jun 2014 14:14:09 +0000 (16:14 +0200)]
radeonsi: BlitFramebuffer should follow render condition

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
10 years agor600g: BlitFramebuffer should follow render condition
Marek Olšák [Mon, 2 Jun 2014 14:13:43 +0000 (16:13 +0200)]
r600g: BlitFramebuffer should follow render condition

10 years agor300g: BlitFramebuffer should follow render condition
Marek Olšák [Mon, 2 Jun 2014 14:07:48 +0000 (16:07 +0200)]
r300g: BlitFramebuffer should follow render condition

10 years agor600g,radeonsi: disable fast clear if render condition is on
Marek Olšák [Mon, 2 Jun 2014 13:45:51 +0000 (15:45 +0200)]
r600g,radeonsi: disable fast clear if render condition is on

For some reason, CP DMA doesn't follow the predicate bit if I enable it,
so this is the only option.

This fixes piglit: spec/NV_conditional_render/clear

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
10 years agomesa: Make glGetIntegerv(GL_*_ARRAY_SIZE) return GL_BGRA.
José Fonseca [Sun, 1 Jun 2014 19:50:17 +0000 (20:50 +0100)]
mesa: Make glGetIntegerv(GL_*_ARRAY_SIZE) return GL_BGRA.

Same as b026b6bbfe3f15c8a7296ac107dc3d31f74e401e, but
COLOR_ARRAY_SIZE/SECONDARY_COLOR_ARRAY_SIZE.

Ideally we wouldn't munge the incoming state, so that we wouldn't need
to unmunge it back on glGet*.  But the array size state is copied and
referred in many places, many of which couldn't take an GLenum like
GL_BGRA instead of a plain integer.  So just hack around on glGet*,
to ensure there is no risk of introducing regressions elsewhere.

This bug causes problems to Apitrace, resulting in wrong traces.  See
https://github.com/apitrace/apitrace/issues/261 for details.

Tested with piglit arb_vertex_array_bgra-get, which was created for this
purpose.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Cc: "10.1 10.2" <mesa-stable@lists.freedesktop.org>
10 years agomesa/main: Make get_hash.c values constant.
José Fonseca [Sun, 1 Jun 2014 07:54:18 +0000 (08:54 +0100)]
mesa/main: Make get_hash.c values constant.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Cc: "10.1 10.2" <mesa-stable@lists.freedesktop.org>
10 years agoi965: Add _default_ name changes to test_eu_compact.c.
Vinson Lee [Tue, 3 Jun 2014 06:38:05 +0000 (23:38 -0700)]
i965: Add _default_ name changes to test_eu_compact.c.

These were missed in commit e374809819d82f2e3e946fe809c4d46061ddc5b5.

Fixes 'make check'.

  CC       test_eu_compact.o
test_eu_compact.c: In function ‘gen_f0_0_MOV_GRF_GRF’:
test_eu_compact.c:222:4: error: implicit declaration of function ‘brw_set_predicate_control’ [-Werror=implicit-function-declaration]
    brw_set_predicate_control(p, true);
    ^
test_eu_compact.c: In function ‘run_tests’:
test_eu_compact.c:270:6: error: implicit declaration of function ‘brw_set_access_mode’ [-Werror=implicit-function-declaration]
      brw_set_access_mode(p, BRW_ALIGN_16);
      ^

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
10 years agoi965/gen8: Print number of instructions directly.
Matt Turner [Sun, 25 May 2014 21:59:06 +0000 (14:59 -0700)]
i965/gen8: Print number of instructions directly.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoi965: Emit compaction stats without walking the assembly.
Matt Turner [Sun, 25 May 2014 21:56:41 +0000 (14:56 -0700)]
i965: Emit compaction stats without walking the assembly.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoi965: Move program header printing to end of generate_code().
Matt Turner [Sun, 25 May 2014 17:46:55 +0000 (10:46 -0700)]
i965: Move program header printing to end of generate_code().

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoi965: Move annotation info into generate code.
Matt Turner [Sun, 25 May 2014 17:42:32 +0000 (10:42 -0700)]
i965: Move annotation info into generate code.

Suggested by Ken as a way to cut down lines of code.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoi965: Put '_default_' in the name of functions that set default state.
Kenneth Graunke [Sat, 31 May 2014 23:57:02 +0000 (16:57 -0700)]
i965: Put '_default_' in the name of functions that set default state.

Eventually we're going to use functions to set bits on an instruction.
Putting 'default' in the name of functions that alter default state will
help distinguins them.

This patch was generated entirely mechanically, by the following:

for file in brw*.{cpp,c,h}; do
   sed -i \
   -e 's/brw_set_mask_control/brw_set_default_mask_control/g' \
   -e 's/brw_set_saturate/brw_set_default_saturate/g' \
   -e 's/brw_set_access_mode/brw_set_default_access_mode/g' \
   -e 's/brw_set_compression_control/brw_set_default_compression_control/g' \
   -e 's/brw_set_predicate_control/brw_set_default_predicate_control/g' \
   -e 's/brw_set_predicate_inverse/brw_set_default_predicate_inverse/g' \
   -e 's/brw_set_flag_reg/brw_set_default_flag_reg/g' \
   -e 's/brw_set_acc_write_control/brw_set_default_acc_write_control/g' \
   $file;
done

No manual changes were done after running that command.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
10 years agoi965: Delete brw_set_conditionalmod.
Kenneth Graunke [Sat, 31 May 2014 01:03:14 +0000 (18:03 -0700)]
i965: Delete brw_set_conditionalmod.

This removes the ability to set the default conditional modifier on all
future instructions.  Nothing uses it, and it's not really a sensible
thing to do anyway.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
10 years agoi965: Eliminate brw_set_conditionalmod from the Gen4-5 compilers.
Kenneth Graunke [Sat, 31 May 2014 00:29:55 +0000 (17:29 -0700)]
i965: Eliminate brw_set_conditionalmod from the Gen4-5 compilers.

With the predication changes eliminated, all this does is set the
conditional modifier on a single instruction.  Doing that directly is
easy, and avoids mucking about with default state.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
10 years agoi965: Don't use brw_set_conditionalmod in the FS and vec4 compilers.
Kenneth Graunke [Fri, 30 May 2014 23:41:32 +0000 (16:41 -0700)]
i965: Don't use brw_set_conditionalmod in the FS and vec4 compilers.

brw_set_conditionalmod and brw_next_insn work together to set the
conditional modifier for the next instruction, then turn it off.
The Gen8+ generators don't implement this: we just set it for all future
instructions, and whack it for each fs_inst/vec4_instruction.

Both approaches work out because we only set conditional_mod on
IR instructions like CMP, AND, and so on, which correspond to exactly
one assembly instruction.  The Gen8 generators would break if we had
an IR instruction that generated multiple instructions, and the Gen4-7
EU emit layer would do...something.

To safeguard against this, assert that we only generated one instruction
if conditional_mod is set, and just set the flag directly on that
instruction rather than altering default state.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
10 years agoi965: Stop setting predication from brw_set_conditionalmod.
Kenneth Graunke [Fri, 30 May 2014 22:16:12 +0000 (15:16 -0700)]
i965: Stop setting predication from brw_set_conditionalmod.

brw_set_conditionalmod has traditionally been complex: it causes
conditionalmod to be set for the next instruction, and then predication
to be set on all future instructions after that.

We may want to generate a flag condition and not use it immediately,
due to instruction scheduling or the like.  Even if not, it's easy
to set things explicitly, and that's clearer.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
10 years agoi965: Drop unnecessary brw_set_conditionalmod() before brw_CMP().
Kenneth Graunke [Wed, 28 May 2014 07:02:18 +0000 (00:02 -0700)]
i965: Drop unnecessary brw_set_conditionalmod() before brw_CMP().

brw_CMP already takes a conditional modifier as a parameter, and sets it
accordingly.  brw_set_conditionalmod() also makes everything after the
next instruction predicated, but we don't need that: we always emit an
IF instruction after load_clip_distance(), and that's already
predicated.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
10 years agoi965/clip: Use the new brw_last_inst macro instead of temporaries.
Kenneth Graunke [Wed, 28 May 2014 06:50:23 +0000 (23:50 -0700)]
i965/clip: Use the new brw_last_inst macro instead of temporaries.

It wasn't too bad before, but the macro is going to be nicer once I
start modifying a lot more instructions in this pattern.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
10 years agoi965: Create a "brw_last_inst" convenience macro.
Kenneth Graunke [Wed, 28 May 2014 06:27:01 +0000 (23:27 -0700)]
i965: Create a "brw_last_inst" convenience macro.

Often times, we want to emit an instruction, then set one field on it,
such as predication or a conditional modifier.  Normally, we'd have to
declare "struct brw_instruction *inst;" and then use "inst =
brw_FOO(...)" to emit the instruction, which can hurt readability.

The new "brw_last_inst" macro refers to the most recently emitted
instruction, so you can just do:

    brw_ADD(...)
    brw_last_inst->header.predicate_control = BRW_PREDICATE_NORMAL;

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
10 years agoi965: Make brw_JMPI set predicate_control based on a parameter.
Kenneth Graunke [Wed, 28 May 2014 05:49:57 +0000 (22:49 -0700)]
i965: Make brw_JMPI set predicate_control based on a parameter.

We use both predicated and unconditional JMPI instructions.  But in each
case, it's clear which we want.  It's simpler to just specify it as a
parameter, rather than relying on default state.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
10 years agoi965: Remove the dst and src0 parameters from brw_JMPI.
Kenneth Graunke [Wed, 28 May 2014 05:45:16 +0000 (22:45 -0700)]
i965: Remove the dst and src0 parameters from brw_JMPI.

In all cases, we set both dst and src0 to brw_ip_reg().  This is no
accident: according to the ISA reference, both are required to be the IP
register.  So, we may as well drop the parameters.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
10 years agoegl/main: Fix eglMakeCurrent when releasing context from current thread.
Beren Minor [Thu, 20 Mar 2014 07:36:34 +0000 (08:36 +0100)]
egl/main: Fix eglMakeCurrent when releasing context from current thread.

EGL 1.4 Specification says that
eglMakeCurrent(display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT)
can be used to release the current thread's ownership on the surfaces
and context.

MESA's egl implementation was only accepting the parameters when the
KHR_surfaceless_context extension is supported.

[chadv] Add quote from the EGL 1.4 spec.
Cc: "10,1, 10.2" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoradeonsi: enable ARB_sample_shading
Marek Olšák [Wed, 7 May 2014 11:15:41 +0000 (13:15 +0200)]
radeonsi: enable ARB_sample_shading

10 years agoradeonsi: implement SAMPLEMASK fragment shader output
Marek Olšák [Tue, 6 May 2014 18:04:31 +0000 (20:04 +0200)]
radeonsi: implement SAMPLEMASK fragment shader output

10 years agoradeonsi: interpolate varyings at sample when full sample shading is enabled
Marek Olšák [Tue, 6 May 2014 17:10:52 +0000 (19:10 +0200)]
radeonsi: interpolate varyings at sample when full sample shading is enabled

10 years agoradeonsi: implement SAMPLEPOS fragment shader input
Marek Olšák [Tue, 6 May 2014 16:20:58 +0000 (18:20 +0200)]
radeonsi: implement SAMPLEPOS fragment shader input

The sample positions are read from a constant buffer.

10 years agoradeonsi: implement SAMPLEID fragment shader input
Marek Olšák [Tue, 6 May 2014 16:12:40 +0000 (18:12 +0200)]
radeonsi: implement SAMPLEID fragment shader input

10 years agoradeonsi: implement set_min_samples
Marek Olšák [Tue, 6 May 2014 11:48:11 +0000 (13:48 +0200)]
radeonsi: implement set_min_samples

This is how per-sample shading is enabled.

10 years agoradeon: add basic register setup for per-sample shading
Marek Olšák [Tue, 6 May 2014 11:44:27 +0000 (13:44 +0200)]
radeon: add basic register setup for per-sample shading

Only for Cayman, SI, CIK.

10 years agoradeon: split cayman_emit_msaa_state into 2 functions
Marek Olšák [Tue, 6 May 2014 11:25:50 +0000 (13:25 +0200)]
radeon: split cayman_emit_msaa_state into 2 functions

The other function will be split up from the framebuffer state.

10 years agoRevert "glx: load dri driver with RTLD_LOCAL so dlclose never fails to unload"
Marek Olšák [Mon, 2 Jun 2014 10:51:09 +0000 (12:51 +0200)]
Revert "glx: load dri driver with RTLD_LOCAL so dlclose never fails to unload"

This reverts commit e3cc0d90e14e62a0a787b6c07a6df0f5c84039be.

It breaks too many apps and completely breaks my desktop too.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=79469

We'll probably need to re-release all stable versions after this is committed.

Cc: "10.1 10.2" <mesa-stable@lists.freedesktop.org>
10 years agor600g: use TGSI_PROPERTY to disable viewport and clipping
Christoph Bumiller [Fri, 16 May 2014 23:20:20 +0000 (01:20 +0200)]
r600g: use TGSI_PROPERTY to disable viewport and clipping

v2 get rid of magic value, use DEFINES
v3 update clip_disable together with vs_position_window_space

Big thanks to Marek Olšák!

Signed-off-by: David Heidelberger <david.heidelberger@ixit.cz>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
10 years agogallium: create TGSI_PROPERTY to disable viewport and clipping
Christoph Bumiller [Fri, 16 May 2014 23:20:19 +0000 (01:20 +0200)]
gallium: create TGSI_PROPERTY to disable viewport and clipping

Marek v2: add a cap

Signed-off-by: Marek Olšák <marek.olsak@amd.com>
10 years agor600g: remove assert on draw with count == 0
Christoph Bumiller [Fri, 16 May 2014 23:20:18 +0000 (01:20 +0200)]
r600g: remove assert on draw with count == 0

Signed-off-by: Marek Olšák <marek.olsak@amd.com>
10 years agor600g: HW bug workaround for TGSI_OPCODE_BREAKC
Christoph Bumiller [Fri, 16 May 2014 23:20:17 +0000 (01:20 +0200)]
r600g: HW bug workaround for TGSI_OPCODE_BREAKC

Signed-off-by: Marek Olšák <marek.olsak@amd.com>
10 years agor600g: implement TGSI_OPCODE_BREAKC
Christoph Bumiller [Fri, 16 May 2014 23:20:16 +0000 (01:20 +0200)]
r600g: implement TGSI_OPCODE_BREAKC

Signed-off-by: Marek Olšák <marek.olsak@amd.com>
10 years agor600g: support all channels of TGSI_FILE_ADDRESS
Christoph Bumiller [Fri, 16 May 2014 23:20:15 +0000 (01:20 +0200)]
r600g: support all channels of TGSI_FILE_ADDRESS

It's allowed in SM3.

v2: fix multi-component tgsi_r600_arl (FLT_TO_INT is trans-only)

Signed-off-by: Marek Olšák <marek.olsak@amd.com>
10 years agor600g: check for PIPE_BIND_BLENDABLE in is_format_supported
Christoph Bumiller [Fri, 16 May 2014 23:20:14 +0000 (01:20 +0200)]
r600g: check for PIPE_BIND_BLENDABLE in is_format_supported

v2: added !util_format_is_depth_or_stencil(format)

Signed-off-by: Marek Olšák <marek.olsak@amd.com>
10 years agor600g: handle PIPE_QUERY_GPU_FINISHED
Christoph Bumiller [Fri, 16 May 2014 23:20:13 +0000 (01:20 +0200)]
r600g: handle PIPE_QUERY_GPU_FINISHED

Signed-off-by: Marek Olšák <marek.olsak@amd.com>
10 years agoi965/fs: Add fs_inst constructor that takes a list of sources.
Matt Turner [Tue, 27 May 2014 01:44:17 +0000 (18:44 -0700)]
i965/fs: Add fs_inst constructor that takes a list of sources.

Also add an emit() function that calls it.

Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoi965/fs: Add a function to resize fs_inst's sources array.
Matt Turner [Thu, 20 Feb 2014 21:14:05 +0000 (13:14 -0800)]
i965/fs: Add a function to resize fs_inst's sources array.

Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoi965/fs: Clean up fs_inst constructors.
Matt Turner [Tue, 27 May 2014 17:25:05 +0000 (10:25 -0700)]
i965/fs: Clean up fs_inst constructors.

In a fashion suggested by Ken.

Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoi965/fs: Loop from 0 to inst->sources, not 0 to 3.
Matt Turner [Mon, 17 Mar 2014 17:39:43 +0000 (10:39 -0700)]
i965/fs: Loop from 0 to inst->sources, not 0 to 3.

Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoi965/fs: Store the number of sources an fs_inst has.
Matt Turner [Thu, 20 Feb 2014 16:18:22 +0000 (08:18 -0800)]
i965/fs: Store the number of sources an fs_inst has.

Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoi965/fs: ralloc fs_inst's fs_reg sources.
Matt Turner [Thu, 20 Feb 2014 05:18:44 +0000 (21:18 -0800)]
i965/fs: ralloc fs_inst's fs_reg sources.

Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoi965/fs: Disable fs_inst assignment operator.
Matt Turner [Thu, 20 Feb 2014 17:14:40 +0000 (09:14 -0800)]
i965/fs: Disable fs_inst assignment operator.

The fs_reg src array is going to turn into a pointer and we'd rather not
consider the implications of shallow copying fs_insts.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoi965/fs: Add and use an fs_inst copy constructor.
Matt Turner [Thu, 20 Feb 2014 17:40:02 +0000 (09:40 -0800)]
i965/fs: Add and use an fs_inst copy constructor.

Will get more complicated when fs_reg src becomes a pointer.

Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoi965: Skip IR annotations with INTEL_DEBUG=noann.
Matt Turner [Thu, 22 May 2014 23:30:07 +0000 (16:30 -0700)]
i965: Skip IR annotations with INTEL_DEBUG=noann.

Running shader-db with INTEL_DEBUG=noann reduces the runtime
from ~90 to ~80 seconds on my machine. It also reduces the disk space
consumed by the .out files from 660 MB (676 on disk) to 343 MB (358 on
disk).

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoi965/fs: Debug the optimization passes by dumping instr to file.
Matt Turner [Mon, 7 Apr 2014 17:25:50 +0000 (10:25 -0700)]
i965/fs: Debug the optimization passes by dumping instr to file.

With INTEL_DEBUG=optimizer, write the output of dump_instructions() to a
file each time an optimization pass makes progress. This lets you easily
diff successive files to see what an optimization pass did.

Example filenames written when running glxgears:
   fs8-0000-00-start
   fs8-0000-01-04-opt_copy_propagate
   fs8-0000-01-06-dead_code_eliminate
   fs8-0000-01-12-compute_to_mrf
   fs8-0000-02-06-dead_code_eliminate
        |   |  |   |
        |   |  |   `-- optimization pass name
        |   |  |
        |   |  `-- optimization pass number in the loop
        |   |
        |   `-- optimization loop interation
        |
        `-- shader program number

Note that with INTEL_DEBUG=optimizer, we disable compact_virtual_grfs,
so that we can diff instruction lists across loop interations without
the register numbers being changes.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoi965: Give dump_instructions() a filename argument.
Matt Turner [Thu, 29 May 2014 20:08:59 +0000 (13:08 -0700)]
i965: Give dump_instructions() a filename argument.

This will allow debugging code to dump the IR after an optimization pass
makes progress (the next patch). Only let it open and write to a file if
the effective user isn't root.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoi965: Give dump_instruction() a FILE* argument.
Matt Turner [Thu, 29 May 2014 18:45:15 +0000 (11:45 -0700)]
i965: Give dump_instruction() a FILE* argument.

Use function overloading rather than default arguments, since gdb
doesn't know about default arguments.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoi965: Add envvar to debug the optimization passes.
Matt Turner [Sat, 12 Apr 2014 04:10:53 +0000 (21:10 -0700)]
i965: Add envvar to debug the optimization passes.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agollvmpipe: (trivial) drop "unswizzled" from some function names
Roland Scheidegger [Thu, 29 May 2014 22:53:36 +0000 (00:53 +0200)]
llvmpipe: (trivial) drop "unswizzled" from some function names

This made sense when swizzled storage layout was used for rendering to tiles.
But nowadays the name just adds confusion (and makes for long lines).

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
10 years agollvmpipe: fix crash when not all attachments are populated in a fb
Roland Scheidegger [Thu, 29 May 2014 22:37:17 +0000 (00:37 +0200)]
llvmpipe: fix crash when not all attachments are populated in a fb

Framebuffers can have NULL attachments since a while. llvmpipe handled
that properly for lp_rast_shade_quads_mask but it seems the change didn't
make it to lp_rast_shade_tile.
This fixes piglit fbo-drawbuffers-none test (though I need to increase
the FB_SIZE from 32 to 256 so the tris cover some tiles fully).
https://bugs.freedesktop.org/show_bug.cgi?id=79421

Cc: "10.1 10.2" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
10 years agosoftpipe: honor the render_condition_enable bit in blits.
Roland Scheidegger [Wed, 28 May 2014 23:22:19 +0000 (01:22 +0200)]
softpipe: honor the render_condition_enable bit in blits.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
10 years agollvmpipe: honor the render_condition_enable bit in blits.
Roland Scheidegger [Wed, 28 May 2014 23:22:11 +0000 (01:22 +0200)]
llvmpipe: honor the render_condition_enable bit in blits.

This fixes piglit nv_conditional_render-blitframebuffer.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
10 years agogallium/docs: improve documentation of render condition wrt blits.
Roland Scheidegger [Wed, 28 May 2014 23:21:20 +0000 (01:21 +0200)]
gallium/docs: improve documentation of render condition wrt blits.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
10 years agosvga: use svga_shader_too_large() in compile_vs()
Brian Paul [Thu, 29 May 2014 19:56:48 +0000 (13:56 -0600)]
svga: use svga_shader_too_large() in compile_vs()

And rework the dummy shader code to match the fragment shader case.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
10 years agosvga: use svga_shader_too_large() in compile_fs()
Brian Paul [Thu, 29 May 2014 19:56:22 +0000 (13:56 -0600)]
svga: use svga_shader_too_large() in compile_fs()

Reviewed-by: José Fonseca <jfonseca@vmware.com>
10 years agosvga: added svga_shader_too_large() helper
Brian Paul [Thu, 29 May 2014 19:55:46 +0000 (13:55 -0600)]
svga: added svga_shader_too_large() helper

To check if a shader bytcode exceeds the device limit.  There's no
limit when using GBS.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
10 years agodarwin: Remove extra kCGLPFAColorSize attribute when requesting an offscreen context
Jeremy Huddleston Sequoia [Sat, 31 May 2014 10:44:51 +0000 (03:44 -0700)]
darwin: Remove extra kCGLPFAColorSize attribute when requesting an offscreen context

https://xquartz.macosforge.org/trac/ticket/650

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
10 years agoutil: Do not use __builtin_clrsb with Intel C++ Compiler.
Vinson Lee [Sat, 31 May 2014 02:40:26 +0000 (19:40 -0700)]
util: Do not use __builtin_clrsb with Intel C++ Compiler.

This patch fixes this build error with icc 14.0.2.

In file included from state_tracker/st_glsl_to_tgsi.cpp(63):
../../src/gallium/auxiliary/util/u_math.h(583): error: identifier "__builtin_clrsb" is undefined
     return 31 - __builtin_clrsb(i);
                 ^

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
10 years agoi915: add a missing NULL pointer check
Lubomir Rintel [Wed, 28 May 2014 06:56:12 +0000 (08:56 +0200)]
i915: add a missing NULL pointer check

mesaVisual can be NULL with configless context since this commit:

    commit 551d459af421a2eb937e9e16301bb64da4624f89
    Author: Neil Roberts <neil@linux.intel.com>
    Date:   Fri Mar 7 18:05:47 2014 +0000

    Add the EGL_MESA_configless_context extension
...
    Previously the i965 and i915 drivers were explicitly creating a zeroed visual
    whenever 0 is passed for the EGLConfig.

We attempt to dereference the visual in i915 and now we don't create a
zeroed-out one one it crashes, breaking at least weston in an i915. There's
no point in doing so as it would be zero anyway.

v2: Fixed a typo in commit message.  Added some tags.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1100967
Cc: "10.2" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoglapi: Duplicate GLES1 prototypes in glapi_dispatch.c
Ian Romanick [Fri, 30 May 2014 20:55:28 +0000 (13:55 -0700)]
glapi: Duplicate GLES1 prototypes in glapi_dispatch.c

These prototypes are necessary because GLES1 library builds will create
dispatch functions for them.  We can't directly include GLES/gl.h
because it would conflict the previously-included GL/gl.h.  Since GLES1
ABI is not expected to every add more functions, the path of least
resistance is to just duplicate the prototypes for the functions that
aren't already in desktop OpenGL.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=79294
Acked-by: Matt Turner <mattst88@gmail.com>
Tested-by: Andreas Boll <andreas.boll.dev@gmail.com>
Cc: "10.2" <mesa-stable@lists.freedesktop.org>
10 years agoi965/vec4: Allow writemasking on math instructions on Gen7+.
Matt Turner [Thu, 29 May 2014 23:47:39 +0000 (16:47 -0700)]
i965/vec4: Allow writemasking on math instructions on Gen7+.

The math instruction was Align1-only on Gen6 and we never updated this
to let it use Align16 features like writemasking on newer platforms.

total instructions in shared programs: 1686120 -> 1685507 (-0.04%)
instructions in affected programs:     48593 -> 47980 (-1.26%)

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoi965: Fix Line Stipple enable bit in 3DSTATE_SF for Haswell.
Pavel Popov [Fri, 30 May 2014 03:50:34 +0000 (10:50 +0700)]
i965: Fix Line Stipple enable bit in 3DSTATE_SF for Haswell.

Cc: "10.1 10.2" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Pavel Popov <pavel.e.popov@intel.com>
10 years agost/wgl: use _debug_printf() instead of fprintf()
Brian Paul [Wed, 28 May 2014 16:01:30 +0000 (10:01 -0600)]
st/wgl: use _debug_printf() instead of fprintf()

This should print output both for debug and release builds.
Suggested by Jose.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
10 years agost/wgl: formatting fixes in stw_framebuffer.c
Brian Paul [Wed, 21 May 2014 17:41:59 +0000 (11:41 -0600)]
st/wgl: formatting fixes in stw_framebuffer.c

And remove some unneeded #includes and INLINE qualifiers.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
10 years agost/wgl: make stw_lookup_context_locked() an inline function
Brian Paul [Wed, 21 May 2014 17:32:30 +0000 (11:32 -0600)]
st/wgl: make stw_lookup_context_locked() an inline function

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
10 years agost/wgl: fix implementation of wglCreateContextAttribsARB()
Brian Paul [Tue, 20 May 2014 20:56:41 +0000 (14:56 -0600)]
st/wgl: fix implementation of wglCreateContextAttribsARB()

wglCreateContextAttribsARB() didn't work previously since it returned
a context ID that wasn't allocated by OPENGL32.DLL.  So if that context
ID was later passed to wglMakeCurrent(), etc. it was rejected.

Now when wglCreateContextAttribsARB() is called we actually call
wglCreateContext() in order to get a valid context ID.  Then we
replace the context data which was created with new context data
which reflects the arguments passed to wglCreateContextAttribsARB().

If there were a DrvCreateContextAttribs() function in the ICD this
work-around wouldn't be necessary.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
Conflicts:
src/gallium/state_trackers/wgl/stw_ext_extensionsstring.c
src/gallium/state_trackers/wgl/stw_getprocaddress.c

10 years agost/wgl: add debug code to check that pixel format initialization worked
Brian Paul [Fri, 21 Mar 2014 17:06:41 +0000 (11:06 -0600)]
st/wgl: add debug code to check that pixel format initialization worked

If the assertion fails, it means something is really broken.  Before,
if this happened we reverted to the GDI renderer without any warning.

Reviewed-by: Matthew McClure <mcclurem@vmware.com>
10 years agost/wgl: change PFD_SWAP_COPY to PFD_SWAP_EXCHANGE.
Brian Paul [Mon, 19 May 2014 15:26:04 +0000 (09:26 -0600)]
st/wgl: change PFD_SWAP_COPY to PFD_SWAP_EXCHANGE.

To reflect our actual SwapBuffers implementation.  See
stw_st_swap_framebuffer_locked().  This fixes various rendering issues
with SolidEdge.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
10 years agodocs: Document how to replace Windows built-in OpenGL software rasterizer with llvmpipe.
José Fonseca [Thu, 29 May 2014 19:02:31 +0000 (20:02 +0100)]
docs: Document how to replace Windows built-in OpenGL software rasterizer with llvmpipe.

Just happened to stumble across this registry key while debugging
something else.

This technique is much neater than trying to override opengl32.dll.

Also a few minors cleanups.

10 years agoscons: add common.c as part of glcpp build
Tapani Pälli [Fri, 30 May 2014 07:10:09 +0000 (10:10 +0300)]
scons: add common.c as part of glcpp build

to have _mesa_error_no_memory function available

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=79440
Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
10 years agomesa: Add missing null checks into prog_hash_table.c
Juha-Pekka Heikkila [Thu, 13 Feb 2014 14:04:23 +0000 (16:04 +0200)]
mesa: Add missing null checks into prog_hash_table.c

Check calloc return values in hash_table_insert() and
hash_table_replace()

Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoglcpp: link with tests/common.c
Tapani Pälli [Fri, 30 May 2014 04:47:05 +0000 (07:47 +0300)]
glcpp: link with tests/common.c

So that prog_hash_table can use _mesa_error_no_memory function.

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
10 years agomesa/main: Add missing null check in _mesa_CreatePerfQueryINTEL()
Juha-Pekka Heikkila [Mon, 12 May 2014 08:01:48 +0000 (11:01 +0300)]
mesa/main: Add missing null check in _mesa_CreatePerfQueryINTEL()

Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
Reviewed-by: Petri Latvala <petri.latvala@intel.com>
10 years agomesa/drivers: Add extra null check in blitframebuffer_texture()
Juha-Pekka Heikkila [Fri, 25 Apr 2014 08:34:12 +0000 (11:34 +0300)]
mesa/drivers: Add extra null check in blitframebuffer_texture()

If texObj == NULL here it mean there is already GL_INVALID_VALUE
or GL_OUT_OF_MEMORY error set to context.

Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoglsl: Add null check in loop_analysis.cpp
Juha-Pekka Heikkila [Thu, 3 Apr 2014 13:51:14 +0000 (16:51 +0300)]
glsl: Add null check in loop_analysis.cpp

Check return value from hash_table_find before using it as a pointer

Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agomesa: add missing null check in _mesa_NewHashTable()
Juha-Pekka Heikkila [Wed, 26 Feb 2014 12:03:19 +0000 (14:03 +0200)]
mesa: add missing null check in _mesa_NewHashTable()

Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoloader: add optional /sys filesystem method for PCI identification.
Gary Wong [Thu, 22 May 2014 03:07:42 +0000 (21:07 -0600)]
loader: add optional /sys filesystem method for PCI identification.

Introduce a simple PCI identification method of looking up the answer
the /sys filesystem (available on Linux).  Attempted after libudev, but
before DRM.

Disabled by default (available only when the --enable-sysfs configure
option is specified).

Signed-off-by: Gary Wong <gtw@gnu.org>
Acked-by: Emil Velikov <emil.l.velikov@gmail.com>
10 years agoloader: allow attempting more than one method of PCI identification.
Gary Wong [Thu, 22 May 2014 02:39:15 +0000 (20:39 -0600)]
loader: allow attempting more than one method of PCI identification.

loader_get_pci_id_for_fd() and loader_get_device_name_for_fd() now attempt
all available strategies to identify the hardware, instead of conditionally
compiling in a single test.  The existing libudev and DRM approaches have
been retained, attempting first libudev (if available) and then DRM (if
necessary).

Signed-off-by: Gary Wong <gtw@gnu.org>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
10 years agost/egl: do not link against libloader
Emil Velikov [Wed, 28 May 2014 14:43:35 +0000 (15:43 +0100)]
st/egl: do not link against libloader

Move the link to the final targets, like any other place in
mesa/gallium. This allows better visibilty and will prevent
us from including the library archive twice.

Resolves multiple definition of `loader_get_pci_id_for_fd'

multiple definition of `loader_get_pci_id_for_fd'

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=79263
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=79382
Cc: Chia-I Wu <olv@lunarg.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Chia-I Wu <olv@lunarg.com>
Tested-by: Michel Dänzer <michel.daenzer@amd.com>
10 years agoegl_dri2: fix wayland_platform when drm_platform is not set
Emil Velikov [Wed, 28 May 2014 13:36:46 +0000 (14:36 +0100)]
egl_dri2: fix wayland_platform when drm_platform is not set

The build fails with implicit delaration of drmGetCap (xf86drm.h)
Were we're including the header only when building the DRM_PLATFORM.

Wayland backend can operate without DRM_PLATFORM so replace the
guard, and fold in drmGetCap() usage to silence compiler warnings.

Cc: Chad Versace <chad.versace@linux.intel.com>
Cc: Kristian Høgsberg <krh@bitplanet.net>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
10 years agoi965/fs: Set correct number of regs_written for MCS fetches.
Matt Turner [Tue, 27 May 2014 22:26:06 +0000 (15:26 -0700)]
i965/fs: Set correct number of regs_written for MCS fetches.

regs_written is in units of virtual GRFs.

Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoglx: load dri driver with RTLD_LOCAL so dlclose never fails to unload
Jerome Glisse [Thu, 29 May 2014 17:32:21 +0000 (13:32 -0400)]
glx: load dri driver with RTLD_LOCAL so dlclose never fails to unload

There is no reason anymore to load with RTLD_GLOBAL and for some driver
this even result in dlclose failing to unload leading to catastrophic
failure with swrast fallback.

Cc: "10.1 10.2" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Jérôme Glisse <jglisse@redhat.com>
10 years agoi915g: Support B5G5R5A1 render targets and textures
Stéphane Marchesin [Wed, 28 May 2014 21:15:07 +0000 (14:15 -0700)]
i915g: Support B5G5R5A1 render targets and textures

10 years agoi915g: Support R4G4B4A4 render targets and textures
Stéphane Marchesin [Wed, 28 May 2014 21:00:20 +0000 (14:00 -0700)]
i915g: Support R4G4B4A4 render targets and textures

10 years agoi915g: Fix copy region code
Stéphane Marchesin [Wed, 28 May 2014 17:29:40 +0000 (10:29 -0700)]
i915g: Fix copy region code

This fixes a few issues with it, also cleans up the code.