platform/upstream/mesa.git
10 years agomesa: Compute proper strides for compressed texture pixel storage.
Chris Forbes [Mon, 2 Jun 2014 03:50:09 +0000 (15:50 +1200)]
mesa: Compute proper strides for compressed texture pixel storage.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agomesa: Extract computation of compressed pixel store params
Chris Forbes [Mon, 2 Jun 2014 03:47:47 +0000 (15:47 +1200)]
mesa: Extract computation of compressed pixel store params

This logic is reusable across CompressedTex*Image* and
GetCompressedTexImage; the strides calculated will also be needed
in the PBO validation functions to ensure that the referenced range of
bytes is valid.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agomesa: Emit errors for inconsistent compressed pixel store state
Chris Forbes [Tue, 20 May 2014 11:41:59 +0000 (23:41 +1200)]
mesa: Emit errors for inconsistent compressed pixel store state

V2: Use bool rather than GLboolean for internal function

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agomesa: Add new pixel pack/unpack state for
Chris Forbes [Tue, 20 May 2014 10:37:13 +0000 (22:37 +1200)]
mesa: Add new pixel pack/unpack state for
ARB_compressed_texture_pixel_storage

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agotests: Add new enum strings for ARB_compressed_texture_pixel_storage
Chris Forbes [Tue, 20 May 2014 09:53:02 +0000 (21:53 +1200)]
tests: Add new enum strings for ARB_compressed_texture_pixel_storage

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoglapi: Add XML infrastructure for ARB_compressed_texture_pixel_storage
Chris Forbes [Tue, 20 May 2014 09:28:41 +0000 (21:28 +1200)]
glapi: Add XML infrastructure for ARB_compressed_texture_pixel_storage

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agomesa: Make CompressedTexSubImage errors more consistent
Chris Forbes [Wed, 21 May 2014 08:03:50 +0000 (20:03 +1200)]
mesa: Make CompressedTexSubImage errors more consistent

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agomesa: Trim down PixelStorei implementation
Chris Forbes [Tue, 20 May 2014 10:26:36 +0000 (22:26 +1200)]
mesa: Trim down PixelStorei implementation

Move _mesa_error call for INVALID_VALUE to one place.
Remove checks for previous value matching -- this was important when we
were flushing vertices before the update, but that hasn't happened for a
long time now.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agomesa/main: Prevent sefgault on glGetIntegerv(GL_ATOMIC_COUNTER_BUFFER_BINDING).
José Fonseca [Fri, 6 Jun 2014 22:59:18 +0000 (23:59 +0100)]
mesa/main: Prevent sefgault on glGetIntegerv(GL_ATOMIC_COUNTER_BUFFER_BINDING).

A recent ApiTrace change, that tries to dump more buffer state
causes Mesa from my distro (10.1.4) to segfaults here.

I haven't actually confirm this fixes it (I can't repro on master),
but it seems a good idea to be defensive here anyway.

Cc: "10.1 10.2" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoRevert "i965: Move brw_land_fwd_jump() to compilation unit of its use."
Iago Toral Quiroga [Thu, 5 Jun 2014 13:03:07 +0000 (15:03 +0200)]
Revert "i965: Move brw_land_fwd_jump() to compilation unit of its use."

This reverts commit f3cb2e6ed7059b22752a6b7d7a98c07ba6b5552e.

brw_land_fwd_jump() is convenient wherever we produce JMPI instructions
and we will use JMPI to implement framebuffer writes that involve line
antialiasing in gen < 6.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoi965: Fix else and brace placement in brw_eu_emit.c.
Kenneth Graunke [Wed, 4 Jun 2014 23:55:59 +0000 (16:55 -0700)]
i965: Fix else and brace placement in brw_eu_emit.c.

I'm making a lot of changes to this area, and I figured I may as well
not conflate these trivial changes.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
10 years agoi965: Drop the remaining default predication whacking.
Kenneth Graunke [Fri, 6 Jun 2014 05:59:10 +0000 (22:59 -0700)]
i965: Drop the remaining default predication whacking.

With my earlier cleaning in place (see git log brw_eu_emit.c), nothing
relies on the instruction emitters for IF/WHILE/JMPI disabling
predication.  Drop it in favor of making callers do the right thing
explicitly.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
10 years agoi965/sf: Use brw_set_default_predicate_control().
Kenneth Graunke [Fri, 6 Jun 2014 05:46:57 +0000 (22:46 -0700)]
i965/sf: Use brw_set_default_predicate_control().

This is a bit tidier than poking at p->current directly.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
10 years agogk110/ir: fix bfind emission
Ilia Mirkin [Sat, 7 Jun 2014 20:37:57 +0000 (16:37 -0400)]
gk110/ir: fix bfind emission

There is a short-immediate version as well, but it should never end up
getting used since it would have gotten folded earlier.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "10.2" <mesa-stable@lists.freedesktop.org>
10 years agodocs: Add MD5 checksum, etc. for 10.2.1 release
Ian Romanick [Sat, 7 Jun 2014 05:20:20 +0000 (22:20 -0700)]
docs: Add MD5 checksum, etc. for 10.2.1 release

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
(cherry picked from commit 70ce1031e7947c28133cb90211ecd6866c079d8b)

10 years agodocs: Add initial 10.2.1 release notes
Ian Romanick [Sat, 7 Jun 2014 05:13:01 +0000 (22:13 -0700)]
docs: Add initial 10.2.1 release notes

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
(cherry picked from commit 8c4845d29b21ec902c59d84e51d95639f0709085)

10 years agoconfigure.ac: Do not use Pthreads with MinGW.
Vinson Lee [Wed, 4 Jun 2014 00:00:24 +0000 (17:00 -0700)]
configure.ac: Do not use Pthreads with MinGW.

Match the behavior of the SCons MinGW build.

This patch also fixes these build errors.

  CC       glapi_entrypoint.lo
glapi_entrypoint.c: In function 'init_glapi_relocs_once':
glapi_entrypoint.c:341:4: error: unknown type name 'pthread_once_t'
    static pthread_once_t once_control = PTHREAD_ONCE_INIT;
    ^
glapi_entrypoint.c:341:41: error: 'PTHREAD_ONCE_INIT' undeclared (first use in this function)
    static pthread_once_t once_control = PTHREAD_ONCE_INIT;
                                         ^
glapi_entrypoint.c:341:41: note: each undeclared identifier is reported only once for each function it appears in
glapi_entrypoint.c:342:4: error: implicit declaration of function 'pthread_once' [-Werror=implicit-function-declaration]
    pthread_once( & once_control, init_glapi_relocs );
    ^

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
10 years agogk110/ir: fix emitting constbuf file index
Ilia Mirkin [Sat, 7 Jun 2014 04:18:34 +0000 (00:18 -0400)]
gk110/ir: fix emitting constbuf file index

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "10.2" <mesa-stable@lists.freedesktop.org>
10 years agodocs: Add MD5 checksum, etc. for 10.1 release
Ian Romanick [Sat, 7 Jun 2014 04:17:02 +0000 (21:17 -0700)]
docs: Add MD5 checksum, etc. for 10.1 release

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
(cherry picked from commit 28d41e409d74aabe35f1031e759179e82cb760b4)

10 years agogk110/ir: emit saturate flag on fadd when needed
Ilia Mirkin [Sat, 7 Jun 2014 03:32:29 +0000 (23:32 -0400)]
gk110/ir: emit saturate flag on fadd when needed

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "10.2" <mesa-stable@lists.freedesktop.org>
10 years agogk110/ir: fix slct emission
Ilia Mirkin [Sat, 7 Jun 2014 02:40:47 +0000 (22:40 -0400)]
gk110/ir: fix slct emission

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "10.2" <mesa-stable@lists.freedesktop.org>
10 years agost/mesa: remove extra calculation of sampler count
Timothy Arceri [Sat, 7 Jun 2014 02:02:56 +0000 (12:02 +1000)]
st/mesa: remove extra calculation of sampler count

This code was originally introduced to fix https://bugs.freedesktop.org/show_bug.cgi?id=53617. The comment says you need to pass NULL in order to unref old views however cso_set_sampler_views() already takes care of old views with the second for loop. Also as of 2355a6441435b8e66a032c44f0794066338e30a3 cso_set_sampler_views() passes the max of the old and new views to the driver for all state trackers making this code obsolete.

Signed-off-by: Timothy Arceri <t_arceri@yahoo.com.au>
Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agogk110/ir: fix interp mode emission
Ilia Mirkin [Sat, 7 Jun 2014 00:33:06 +0000 (20:33 -0400)]
gk110/ir: fix interp mode emission

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "10.2" <mesa-stable@lists.freedesktop.org>
10 years agogk110/ir: fix ISAD emission with register args
Ilia Mirkin [Fri, 6 Jun 2014 23:52:49 +0000 (19:52 -0400)]
gk110/ir: fix ISAD emission with register args

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "10.2" <mesa-stable@lists.freedesktop.org>
10 years agogk110/ir: fix quadon opcode emission
Ilia Mirkin [Fri, 6 Jun 2014 23:27:28 +0000 (19:27 -0400)]
gk110/ir: fix quadon opcode emission

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "10.2" <mesa-stable@lists.freedesktop.org>
10 years agonvc0: don't bother trying to set up compute for gk110+
Ilia Mirkin [Fri, 6 Jun 2014 19:36:27 +0000 (15:36 -0400)]
nvc0: don't bother trying to set up compute for gk110+

The nouveau fw currently prints a bunch of errors. No point in seeing
those all the time, esp since compute doesn't really work in the first
place.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Ben Skeggs <bskeggs@redhat.com>
Cc: "10.2" <mesa-stable@lists.freedesktop.org>
10 years agogk110: add in forgotten code for gk110 isa
Ilia Mirkin [Fri, 6 Jun 2014 19:29:57 +0000 (15:29 -0400)]
gk110: add in forgotten code for gk110 isa

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Ben Skeggs <bskeggs@redhat.com>
Cc: "10.2" <mesa-stable@lists.freedesktop.org>
10 years agogk110/ir: emit texbar the same way that the blob does
Ilia Mirkin [Fri, 6 Jun 2014 19:29:21 +0000 (15:29 -0400)]
gk110/ir: emit texbar the same way that the blob does

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Ben Skeggs <bskeggs@redhat.com>
Cc: "10.2" <mesa-stable@lists.freedesktop.org>
10 years agoscons: Search only for mingw-w64 cross-compilers.
José Fonseca [Fri, 6 Jun 2014 12:13:05 +0000 (13:13 +0100)]
scons: Search only for mingw-w64 cross-compilers.

Some distros still ship the non-mingw-w64 cross-compilers, but they are
can't build Mesa properly, as Jakob pointed out.

10 years agoi915g: Remove 4444 and 5551 formats
Stéphane Marchesin [Fri, 30 May 2014 03:22:02 +0000 (20:22 -0700)]
i915g: Remove 4444 and 5551 formats

They don't seem to work 100%, I need to investigate but in the
meantime let's remove them.

10 years agonvc0/ir: Handle OP_POPCNT when folding constant expressions
Tobias Klausmann [Tue, 3 Jun 2014 22:35:50 +0000 (00:35 +0200)]
nvc0/ir: Handle OP_POPCNT when folding constant expressions

Signed-off-by: Tobias Klausmann <tobias.johannes.klausmann@mni.thm.de>
[imirkin: make sure to only fold 1-arg popcnt in opnd]
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agonvc0/ir: Handle OP_BFIND when folding constant expressions
Tobias Klausmann [Tue, 3 Jun 2014 22:35:49 +0000 (00:35 +0200)]
nvc0/ir: Handle OP_BFIND when folding constant expressions

Signed-off-by: Tobias Klausmann <tobias.johannes.klausmann@mni.thm.de>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agonvc0/ir: Handle reverse subop for OP_EXTBF when folding constant expressions
Tobias Klausmann [Tue, 3 Jun 2014 22:35:48 +0000 (00:35 +0200)]
nvc0/ir: Handle reverse subop for OP_EXTBF when folding constant expressions

Signed-off-by: Tobias Klausmann <tobias.johannes.klausmann@mni.thm.de>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agonv50/ir: clear subop when folding constant expressions
Tobias Klausmann [Tue, 3 Jun 2014 22:35:47 +0000 (00:35 +0200)]
nv50/ir: clear subop when folding constant expressions

Some operations (e.g. OP_MUL/OP_MAD/OP_EXTBF) might have a subop set.
After folding, make sure that it is cleared

Signed-off-by: Tobias Klausmann <tobias.johannes.klausmann@mni.thm.de>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "10.1 10.2" <mesa-stable@lists.freedesktop.org>
10 years agoi965: Support GL_CLAMP natively on Broadwell.
Kenneth Graunke [Thu, 29 May 2014 06:31:48 +0000 (23:31 -0700)]
i965: Support GL_CLAMP natively on Broadwell.

The new hardware actually supports this OpenGL 1.x feature natively,
so we can finally drop our shader workarounds.

Not many applications use GL_CLAMP, and most use it unintentionally, but
it's trivial to do right, so we should.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Cc: "10.2" <mesa-stable@lists.freedesktop.org>
10 years agoi965: Pass brw to translate_wrap_mode().
Kenneth Graunke [Thu, 29 May 2014 06:37:44 +0000 (23:37 -0700)]
i965: Pass brw to translate_wrap_mode().

This lets us do generation checks.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Cc: "10.2" <mesa-stable@lists.freedesktop.org>
10 years agoi965: use _mesa_align_malloc in intel_miptree_map_movntdqa
Tapani Pälli [Thu, 5 Jun 2014 04:48:09 +0000 (07:48 +0300)]
i965: use _mesa_align_malloc in intel_miptree_map_movntdqa

This fixes case where we have 1x1 size buffer and misalignment is 0.

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=79616

10 years agoi965/fs: Allow array dereference of HW_REG.
Chris Forbes [Wed, 4 Jun 2014 09:06:31 +0000 (21:06 +1200)]
i965/fs: Allow array dereference of HW_REG.

When dereferencing an element of gl_SampleMaskIn[], the source register
here will be a HW_REG rather than a VGRF because the payload slot is
now exposed directly.

Fixes an assertion failure in the Piglit test:

   tests/spec/arb_gpu_shader5/execution/samplemaskin-basic

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Cc: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agost/omx/enc: enable b frames
Leo Liu [Fri, 30 May 2014 19:57:29 +0000 (15:57 -0400)]
st/omx/enc: enable b frames

Signed-off-by: Leo Liu <leo.liu@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
10 years agoradeon/vce: implement h264 profile support
Leo Liu [Fri, 30 May 2014 19:57:28 +0000 (15:57 -0400)]
radeon/vce: implement h264 profile support

Signed-off-by: Leo Liu <leo.liu@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
10 years agost/omx/enc: implement h264 profile support
Leo Liu [Fri, 30 May 2014 19:57:27 +0000 (15:57 -0400)]
st/omx/enc: implement h264 profile support

Signed-off-by: Leo Liu <leo.liu@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
10 years agovl: add more avc profiles
Leo Liu [Fri, 30 May 2014 19:57:26 +0000 (15:57 -0400)]
vl: add more avc profiles

Signed-off-by: Leo Liu <leo.liu@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
10 years agowgl: Disable CRT message boxes when Windows system error messages boxes are disabled.
José Fonseca [Tue, 3 Jun 2014 17:08:34 +0000 (18:08 +0100)]
wgl: Disable CRT message boxes when Windows system error messages boxes are disabled.

At least on MSVC we statically link against the CRT, so we must disable
the CRT message boxes if we want unattended testing.

The messages are convenient when running manually, so let them be if the
system error message boxes are not disabled.

10 years agoglapi: Note apparent gap in numbering from ARB_multi_draw_indirect
Chris Forbes [Sat, 25 Jan 2014 06:51:49 +0000 (19:51 +1300)]
glapi: Note apparent gap in numbering from ARB_multi_draw_indirect

This is defined in the same included file as ARB_draw_indirect.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
10 years agodocs: Mark off gs5/overload resolution
Chris Forbes [Wed, 4 Jun 2014 08:12:58 +0000 (20:12 +1200)]
docs: Mark off gs5/overload resolution

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
10 years agoglsl: Implement overload resolution for ARB_gpu_shader5
Chris Forbes [Sun, 4 May 2014 08:24:01 +0000 (20:24 +1200)]
glsl: Implement overload resolution for ARB_gpu_shader5

V3: Move spec citation into the code.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
10 years agoglsl: Add support for comparing function parameter conversions
Chris Forbes [Sun, 4 May 2014 08:24:00 +0000 (20:24 +1200)]
glsl: Add support for comparing function parameter conversions

The ARB_gpu_shader5 spec says:

"To determine whether the conversion for a single argument in one match is
better than that for another match, the following rules are applied, in
order:

  1. An exact match is better than a match involving any implicit
     conversion.

  2. A match involving an implicit conversion from float to double is
     better than a match involving any other implicit conversion.

  3. A match involving an implicit conversion from either int or uint to
     float is better than a match involving an implicit conversion from
     either int or uint to double.

If none of the rules above apply to a particular pair of conversions,
neither conversion is considered better than the other."

V3: Add spec citation, including oddball difference between gs5 and GLSL
4.0; comment a bit better as per Jordan's suggestions.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
10 years agoglsl: Build a list of inexact function matches
Chris Forbes [Sun, 4 May 2014 08:23:59 +0000 (20:23 +1200)]
glsl: Build a list of inexact function matches

This will facilitate GLSL 4.0 / ARB_gpu_shader5's enhanced overload
resolution rules, and also possibly better error reporting for ambiguous
function calls.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
10 years agodocs: Mark off gs5/implicit conversions
Chris Forbes [Wed, 4 Jun 2014 07:31:30 +0000 (19:31 +1200)]
docs: Mark off gs5/implicit conversions

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
10 years agoglsl: Allow int -> uint implicit conversions on function parameters
Chris Forbes [Sun, 4 May 2014 08:23:58 +0000 (20:23 +1200)]
glsl: Allow int -> uint implicit conversions on function parameters

V2: Fix crashes during linking, where the parse state is NULL. In this
case, all required checks have already been done, so we assume the
extension is enabled.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoglsl: Pass parse state to can_implicitly_convert_to()
Chris Forbes [Sun, 4 May 2014 08:23:57 +0000 (20:23 +1200)]
glsl: Pass parse state to can_implicitly_convert_to()

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoglsl: Pass parse state to parameter_lists_match()
Chris Forbes [Sun, 4 May 2014 08:23:56 +0000 (20:23 +1200)]
glsl: Pass parse state to parameter_lists_match()

The available implicit conversions depend on the GLSL version we're
compiling.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoglsl: Add support for int -> uint implicit conversions
Chris Forbes [Sun, 4 May 2014 08:23:55 +0000 (20:23 +1200)]
glsl: Add support for int -> uint implicit conversions

This is required for ARB_gpu_shader5.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoglsl: Clean up apply_implicit_conversion
Chris Forbes [Sun, 4 May 2014 08:23:54 +0000 (20:23 +1200)]
glsl: Clean up apply_implicit_conversion

We're about to add new implicit conversions, first for ARB_gpu_shader5,
and then later for ARB_gpu_shader_fp64. Pull out the opcode
determination into its own function, and get rid of the bool -> float
case that could never be hit anyway [since it fails the is_numeric()
check].

V2: Retain the vector width mangling. It turns out this is necessary for
the conversions done (and then thrown away) when determining the return
type of arithmetic operators.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agodocs: Update `precise` qualifier status in GL3.txt
Chris Forbes [Sun, 27 Apr 2014 04:03:57 +0000 (16:03 +1200)]
docs: Update `precise` qualifier status in GL3.txt

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
10 years agoglsl: Allow `precise` as a parameter qualifier
Chris Forbes [Sun, 27 Apr 2014 04:03:56 +0000 (16:03 +1200)]
glsl: Allow `precise` as a parameter qualifier

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
10 years agoglsl: Disallow `precise` redeclarations of vars from outer scopes
Chris Forbes [Sun, 27 Apr 2014 04:03:55 +0000 (16:03 +1200)]
glsl: Disallow `precise` redeclarations of vars from outer scopes

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