mesa.git
8 years agogallium/radeon: reduce alloca of temporaries based on usagemask
Nicolai Hähnle [Mon, 8 Aug 2016 20:31:02 +0000 (22:31 +0200)]
gallium/radeon: reduce alloca of temporaries based on usagemask

v2: take actual writemasks into account

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agogallium/radeon: use tgsi_scan_arrays for temp arrays
Nicolai Hähnle [Wed, 10 Aug 2016 16:50:24 +0000 (18:50 +0200)]
gallium/radeon: use tgsi_scan_arrays for temp arrays

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agogallium/radeon: allocate temps array info in radeon_llvm_context_init
Nicolai Hähnle [Wed, 10 Aug 2016 16:41:21 +0000 (18:41 +0200)]
gallium/radeon: allocate temps array info in radeon_llvm_context_init

Also, prepare for using tgsi_array_info.

This also opens the door for properly handling allocation failures, but I'm
leaving that for a separate change.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agogallium/radeon: always do the full store in store_value_to_array
Nicolai Hähnle [Mon, 8 Aug 2016 21:20:45 +0000 (23:20 +0200)]
gallium/radeon: always do the full store in store_value_to_array

Doing the write-back of the temporary vector in radeon_llvm_emit_store makes
no sense.

This also allows us to get rid of get_alloca_for_array.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agogallium/radeon: extract common getelementptr logic into get_pointer_into_array
Nicolai Hähnle [Mon, 8 Aug 2016 21:13:44 +0000 (23:13 +0200)]
gallium/radeon: extract common getelementptr logic into get_pointer_into_array

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agogallium/radeon: pass indirect register info into get_alloca_for_array
Nicolai Hähnle [Mon, 8 Aug 2016 20:50:05 +0000 (22:50 +0200)]
gallium/radeon: pass indirect register info into get_alloca_for_array

To have the same signature as get_array_range.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agogallium/radeon: extract common lookup code into get_temp_array function
Nicolai Hähnle [Mon, 8 Aug 2016 20:43:09 +0000 (22:43 +0200)]
gallium/radeon: extract common lookup code into get_temp_array function

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agogallium/radeon: clarify the comment on the array alloca heuristic
Nicolai Hähnle [Mon, 8 Aug 2016 20:15:04 +0000 (22:15 +0200)]
gallium/radeon: clarify the comment on the array alloca heuristic

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agogallium/radeon: more descriptive names for LLVM temporaries in debug builds
Nicolai Hähnle [Mon, 8 Aug 2016 19:55:47 +0000 (21:55 +0200)]
gallium/radeon: more descriptive names for LLVM temporaries in debug builds

Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agogallium/radeon: simplify radeon_llvm_emit_store for direct array addressing
Nicolai Hähnle [Mon, 8 Aug 2016 17:54:53 +0000 (19:54 +0200)]
gallium/radeon: simplify radeon_llvm_emit_store for direct array addressing

We can use the pointer stored in the temps array directly.

Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agogallium/radeon: simplify radeon_llvm_emit_fetch for direct array addressing
Nicolai Hähnle [Mon, 8 Aug 2016 17:52:46 +0000 (19:52 +0200)]
gallium/radeon: simplify radeon_llvm_emit_fetch for direct array addressing

We can use the pointer stored in the temps array directly.

Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agogallium/radeon: clean up emit_declaration for temporaries
Nicolai Hähnle [Mon, 8 Aug 2016 17:50:52 +0000 (19:50 +0200)]
gallium/radeon: clean up emit_declaration for temporaries

In the alloca'd array case, no longer create redundant and unused allocas
for the individual elements; create getelementptrs instead.

Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agost_glsl_to_tgsi: use calloc the way it's meant to be used
Nicolai Hähnle [Mon, 8 Aug 2016 18:41:04 +0000 (20:41 +0200)]
st_glsl_to_tgsi: use calloc the way it's meant to be used

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agotgsi/scan: add tgsi_scan_arrays
Nicolai Hähnle [Wed, 10 Aug 2016 16:05:13 +0000 (18:05 +0200)]
tgsi/scan: add tgsi_scan_arrays

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agoglsl: Add missing ir_quadop_vector constant evaluation for Boolean types
Ian Romanick [Tue, 12 Jul 2016 23:23:27 +0000 (16:23 -0700)]
glsl: Add missing ir_quadop_vector constant evaluation for Boolean types

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
8 years agoglsl: Fix typo in ir_unop_f2u implementation
Ian Romanick [Wed, 13 Jul 2016 00:06:34 +0000 (17:06 -0700)]
glsl: Fix typo in ir_unop_f2u implementation

This won't affect the output, but it was, technically, wrong.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
8 years agoglsl: Fix typo in ir_unop_b2i implementation
Ian Romanick [Mon, 11 Jul 2016 22:38:00 +0000 (15:38 -0700)]
glsl: Fix typo in ir_unop_b2i implementation

This won't affect the output, but it was, technically, wrong.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
8 years agoglsl: Don't support integer types for operations that can't handle them
Ian Romanick [Sat, 9 Jul 2016 00:39:48 +0000 (17:39 -0700)]
glsl: Don't support integer types for operations that can't handle them

ir_unop_fract already forbade integer types in ir_validate.  ir_unop_rcp,
ir_unop_rsq, and ir_unop_sqrt should also forbid them in ir_validate.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
8 years agoglsl: Don't support ir_unop_abs or ir_unop_sign for unsigned integers
Ian Romanick [Sat, 9 Jul 2016 00:34:53 +0000 (17:34 -0700)]
glsl: Don't support ir_unop_abs or ir_unop_sign for unsigned integers

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
8 years agonir/algebraic: Optimize common array indexing sequence
Ian Romanick [Wed, 20 Jul 2016 00:47:38 +0000 (17:47 -0700)]
nir/algebraic: Optimize common array indexing sequence

Some shaders include code that looks like:

   uniform int i;
   uniform vec4 bones[...];

   foo(bones[i * 3], bones[i * 3 + 1], bones[i * 3 + 2]);

CSE would do some work on this:

   x = i * 3
   foo(bones[x], bones[x + 1], bones[x + 2]);

The compiler may then add '<< 4 + base' to the index calculations.
This results in expressions like

   x = i * 3
   foo(bones[x << 4], bones[(x + 1) << 4], bones[(x + 2) << 4]);

Just rearranging the math to produce (i * 48) + 16 saves an
instruction, and it allows CSE to do more work.

   x = i * 48;
   foo(bones[x], bones[x + 16], bones[x + 32]);

So, ~6 instructions becomes ~3.

Some individual shader-db results look pretty bad.  However, I have a
really, really hard time believing the change in estimated cycles in,
for example, 3dmmes-taiji/51.shader_test after looking that change in
the generated code.

G45
total instructions in shared programs: 4020840 -> 4010070 (-0.27%)
instructions in affected programs: 177460 -> 166690 (-6.07%)
helped: 894
HURT: 0

total cycles in shared programs: 98829000 -> 98784990 (-0.04%)
cycles in affected programs: 3936648 -> 3892638 (-1.12%)
helped: 894
HURT: 0

Ironlake
total instructions in shared programs: 6418887 -> 6408117 (-0.17%)
instructions in affected programs: 177460 -> 166690 (-6.07%)
helped: 894
HURT: 0

total cycles in shared programs: 143504542 -> 143460532 (-0.03%)
cycles in affected programs: 3936648 -> 3892638 (-1.12%)
helped: 894
HURT: 0

Sandy Bridge
total instructions in shared programs: 8357887 -> 8339251 (-0.22%)
instructions in affected programs: 432715 -> 414079 (-4.31%)
helped: 2795
HURT: 0

total cycles in shared programs: 118284184 -> 118207412 (-0.06%)
cycles in affected programs: 6114626 -> 6037854 (-1.26%)
helped: 2478
HURT: 317

Ivy Bridge
total instructions in shared programs: 7669390 -> 7653822 (-0.20%)
instructions in affected programs: 388234 -> 372666 (-4.01%)
helped: 2795
HURT: 0

total cycles in shared programs: 68381982 -> 68263684 (-0.17%)
cycles in affected programs: 1972658 -> 1854360 (-6.00%)
helped: 2458
HURT: 307

Haswell
total instructions in shared programs: 7082636 -> 7067068 (-0.22%)
instructions in affected programs: 388234 -> 372666 (-4.01%)
helped: 2795
HURT: 0

total cycles in shared programs: 68282020 -> 68164158 (-0.17%)
cycles in affected programs: 1891820 -> 1773958 (-6.23%)
helped: 2459
HURT: 261

Broadwell
total instructions in shared programs: 9002466 -> 8985875 (-0.18%)
instructions in affected programs: 658784 -> 642193 (-2.52%)
helped: 2795
HURT: 5

total cycles in shared programs: 78503092 -> 78450404 (-0.07%)
cycles in affected programs: 2873304 -> 2820616 (-1.83%)
helped: 2275
HURT: 415

Skylake
total instructions in shared programs: 9156978 -> 9140387 (-0.18%)
instructions in affected programs: 682625 -> 666034 (-2.43%)
helped: 2795
HURT: 5

total cycles in shared programs: 75591392 -> 75550574 (-0.05%)
cycles in affected programs: 3192120 -> 3151302 (-1.28%)
helped: 2271
HURT: 425

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Thomas Helland <thomashelland90@gmail.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agoglx: Don't use current context in __glXSendError
Michel Dänzer [Tue, 16 Aug 2016 06:35:44 +0000 (15:35 +0900)]
glx: Don't use current context in __glXSendError

There's no guarantee that there is one, and we don't need one anyway.

Fixes piglit tests:

glx@glx-fbconfig-bad
glx@glx_ext_import_context@import context, multi process
glx@glx_ext_import_context@import context, single process

Fixes: 2e3f067458e4 ("glx: fix error code when there is no context bound")
Cc: "11.2" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
8 years agonv50/ir: fix bb positions after exit instructions
Ilia Mirkin [Sun, 14 Aug 2016 02:19:39 +0000 (22:19 -0400)]
nv50/ir: fix bb positions after exit instructions

It's fairly rare that the BB layout puts BBs after the exit block, which
is likely the reason these issues lingered for so long.

This fixes a fraction of issues with the giant pixmark piano shader.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Cc: <mesa-stable@lists.freedesktop.org>
8 years agonv50/ir: properly clear upper bits of a bitset fill
Ilia Mirkin [Sat, 13 Aug 2016 19:45:35 +0000 (15:45 -0400)]
nv50/ir: properly clear upper bits of a bitset fill

Found by inspection. In practice, val is always == 0, so this never got
triggered.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agoi965/fs: Estimate maximum sampler message execution size more accurately.
Francisco Jerez [Fri, 12 Aug 2016 21:05:19 +0000 (14:05 -0700)]
i965/fs: Estimate maximum sampler message execution size more accurately.

The current logic used to determine the execution size of sampler
messages was based on special-casing several argument and opcode
combinations, which unsurprisingly missed the possibility that some
messages could exceed the payload size limit or not depending on the
number of coordinate components present.  In particular:

 - The TXL, TXB and TEX messages (the latter on non-FS stages only)
   would attempt to use SIMD16 on Gen7+ hardware even if a shadow
   reference was present and the texture was a cubemap array, causing
   it to overflow the maximum supported sampler payload size and
   crash.

 - The TG4_OFFSET message with shadow comparison was falling back to
   SIMD8 regardless of the number of coordinate components, which is
   unnecessary when two coordinates or less are present.

Both cases have been handled incorrectly ever since cubemap arrays and
texture gather were respectively enabled (the current logic used by
the SIMD lowering pass is almost unchanged from the previous no16
fall-back logic used pre-SIMD lowering times).

Fixes the following GL4.5 conformance test on Gen7-8 (the bug also
affects Gen9+ in principle, but SKL passes the test by luck because it
manages to use the TXL_LZ message instead of TXL):

 GL45-CTS.texture_cube_map_array.sampling

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97267
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoi965/fs: Return zero from fs_inst::components_read for non-present sources.
Francisco Jerez [Sat, 13 Aug 2016 01:33:58 +0000 (18:33 -0700)]
i965/fs: Return zero from fs_inst::components_read for non-present sources.

This makes it easier for the caller to find out how many scalar
components are actually read by the instruction.  As a bonus we no
longer need to special-case BAD_FILE in the implementation of
fs_inst::regs_read.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoi965/fs: Lower TEX to TXL during NIR translation.
Francisco Jerez [Fri, 12 Aug 2016 18:38:29 +0000 (11:38 -0700)]
i965/fs: Lower TEX to TXL during NIR translation.

This simplifies the code slightly and will allow the SIMD lowering
pass to find out easily what the actual texturing opcode is in order
to determine the maximum execution size of texturing instructions.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agofreedreno/a3xx: fix generic clear path
Rob Clark [Tue, 16 Aug 2016 23:13:55 +0000 (19:13 -0400)]
freedreno/a3xx: fix generic clear path

Signed-off-by: Rob Clark <robdclark@gmail.com>
8 years agost/mesa: use pipe var instead of st->pipe in st_create_context_priv()
Brian Paul [Fri, 12 Aug 2016 18:37:02 +0000 (12:37 -0600)]
st/mesa: use pipe var instead of st->pipe in st_create_context_priv()

As is done in most other places in the function.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agogallium: remove unused u_clear.h file
Brian Paul [Thu, 11 Aug 2016 15:32:18 +0000 (09:32 -0600)]
gallium: remove unused u_clear.h file

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agogallium/i915: inline the util_clear() code into i915_clear_blitter()
Brian Paul [Thu, 11 Aug 2016 15:30:51 +0000 (09:30 -0600)]
gallium/i915: inline the util_clear() code into i915_clear_blitter()

This is the only place the util_clear() function was used.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agogallium/util: minor reformatting in u_box.h
Brian Paul [Thu, 11 Aug 2016 15:16:39 +0000 (09:16 -0600)]
gallium/util: minor reformatting in u_box.h

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agosvga: remove unused var in svga_mark_surfaces_dirty()
Brian Paul [Tue, 16 Aug 2016 14:27:49 +0000 (08:27 -0600)]
svga: remove unused var in svga_mark_surfaces_dirty()

Signed-off-by: Brian Paul <brianp@vmware.com>
8 years agosvga: avoid a calloc in svga_buffer_transfer_map()
Brian Paul [Tue, 2 Aug 2016 20:30:41 +0000 (14:30 -0600)]
svga: avoid a calloc in svga_buffer_transfer_map()

Just initialize the two other pipe_transfer fields explicitly.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
8 years agosvga: don't call os_get_time() when not needed by Gallium HUD
Brian Paul [Tue, 2 Aug 2016 20:27:33 +0000 (14:27 -0600)]
svga: don't call os_get_time() when not needed by Gallium HUD

The calls to os_get_time() were showing up higher than expected in
profiles.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
8 years agosvga: remove unneeded memset() call in draw_vgpu10()
Brian Paul [Mon, 1 Aug 2016 22:31:13 +0000 (16:31 -0600)]
svga: remove unneeded memset() call in draw_vgpu10()

All three fields of the vbuffer_attrs[] array are assigned in the following
loop.  The remaining elements of the array are not used.

Tested with full Piglit run, Heaven 4.0, etc.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
8 years agosvga: reduce looping in svga_mark_surfaces_dirty()
Brian Paul [Mon, 1 Aug 2016 22:30:14 +0000 (16:30 -0600)]
svga: reduce looping in svga_mark_surfaces_dirty()

We don't need to loop over the max number of color buffers, just the
current number (which is usually one).

Tested with full Piglit run, Heaven 4.0, etc.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
8 years agosvga: minor clean-ups in define_rasterizer_object()
Brian Paul [Fri, 29 Jul 2016 15:10:02 +0000 (09:10 -0600)]
svga: minor clean-ups in define_rasterizer_object()

Add const qualifiers, new comment.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
8 years agosvga: remove incorrect buffer invalidation code
Brian Paul [Mon, 15 Aug 2016 22:33:16 +0000 (16:33 -0600)]
svga: remove incorrect buffer invalidation code

Fixes regression with team_fortress_2 trace.
This change has been in our in-house tree for some time.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
8 years agosvga: additional comments for svga_hw_draw_state members
Brian Paul [Fri, 12 Aug 2016 19:13:22 +0000 (13:13 -0600)]
svga: additional comments for svga_hw_draw_state members

And re-order a few fields.

Signed-off-by: Brian Paul <brianp@vmware.com>
8 years agosvga: use the sws local var to simplify some code
Brian Paul [Mon, 15 Aug 2016 17:38:39 +0000 (11:38 -0600)]
svga: use the sws local var to simplify some code

Signed-off-by: Brian Paul <brianp@vmware.com>
8 years agosvga: minor whitespace and code clean-ups
Brian Paul [Thu, 11 Aug 2016 15:52:31 +0000 (09:52 -0600)]
svga: minor whitespace and code clean-ups

Signed-off-by: Brian Paul <brianp@vmware.com>
8 years agofreedreno/a4xx: use generic clear path
Rob Clark [Thu, 11 Aug 2016 16:00:52 +0000 (12:00 -0400)]
freedreno/a4xx: use generic clear path

Signed-off-by: Rob Clark <robdclark@gmail.com>
8 years agofreedreno/a3xx: use generic clear path
Rob Clark [Thu, 11 Aug 2016 15:59:51 +0000 (11:59 -0400)]
freedreno/a3xx: use generic clear path

Signed-off-by: Rob Clark <robdclark@gmail.com>
8 years agofreedreno: support for using generic clear path
Rob Clark [Thu, 11 Aug 2016 15:57:28 +0000 (11:57 -0400)]
freedreno: support for using generic clear path

Since clears are more or less just normal draws, there isn't that much
benefit in having hand-rolled clear path.  Add support to use u_blitter
instead if gen specific backend doesn't implement ctx->clear().

Signed-off-by: Rob Clark <robdclark@gmail.com>
8 years agogallium/u_blitter: split out a helper for common clear state
Rob Clark [Sat, 13 Aug 2016 14:51:51 +0000 (10:51 -0400)]
gallium/u_blitter: split out a helper for common clear state

Signed-off-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agogallium/u_blitter: add helper to save FS const buffer state
Rob Clark [Sat, 13 Aug 2016 14:36:00 +0000 (10:36 -0400)]
gallium/u_blitter: add helper to save FS const buffer state

Not (currently) state that is overwridden by u_blitter itself, but
drivers with custom blit/clear which are reusing part of the u_blitter
infrastructure will use it.

Signed-off-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agogallium/u_blitter: export some functions
Rob Clark [Sat, 13 Aug 2016 14:35:23 +0000 (10:35 -0400)]
gallium/u_blitter: export some functions

Signed-off-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agoegl/dri2: dri2_make_current: Release previous context's display
Nicolas Boichat [Thu, 11 Aug 2016 08:43:32 +0000 (16:43 +0800)]
egl/dri2: dri2_make_current: Release previous context's display

eglMakeCurrent can also be used to change the active display. In that
case, we need to decrement ref_count of the previous display (possibly
destroying it), and increment it on the next display.

Also, old_dsurf/old_rsurf cannot be non-NULL if old_ctx is NULL, so
we only need to test if old_ctx is non-NULL.

v2: Save the old display before destroying the context.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97214
Fixes: 9ee683f877 (egl/dri2: Add reference count for dri2_egl_display)
Cc: "12.0" <mesa-stable@lists.freedesktop.org>
Reported-by: Alexandr Zelinsky <mexahotabop@w1l.ru>
Tested-by: Alexandr Zelinsky <mexahotabop@w1l.ru>
Reviewed-and-Tested-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
8 years agost/vdpau: change the order in which filters are applied(v3)
Nayan Deshmukh [Fri, 12 Aug 2016 14:02:51 +0000 (19:32 +0530)]
st/vdpau: change the order in which filters are applied(v3)

Apply the median and matrix filter before the compostioning
we apply the deinterlacing first to avoid the extra overhead
in processing the past and the future surfaces in deinterlacing.

v2: apply the filters on all the surfaces (Christian)
v3: use get_sampler_view_planes() instead of
    get_sampler_view_components() and iterate over
    VL_MAX_SURFACES (Christian)

Signed-off-by: Nayan Deshmukh <nayan26deshmukh@gmail.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
8 years agoglcpp: Update tests for new #undef of built-in macro rules.
Kenneth Graunke [Mon, 15 Aug 2016 04:00:31 +0000 (21:00 -0700)]
glcpp: Update tests for new #undef of built-in macro rules.

Ian recently changed the preprocessor to allow this in most GLSL
versions, but not GLSL ES 3.00+.  This patch converts the existing
test that expects a failure to a #version 300 es shader, and adds
a #version 110 shader to make sure that it's allowed.

Fixes 'make check'.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97307
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
Tested-by: Vinson Lee <vlee@freedesktop.org>
8 years agoanv: fix writemask on blit fragment shader.
Dave Airlie [Tue, 16 Aug 2016 00:00:28 +0000 (10:00 +1000)]
anv: fix writemask on blit fragment shader.

I'm not sure if anything even uses this, but I found this on radv, so
just fix it on anv for consistency.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agoegl/android: Set dpy->DriverData to NULL on error
Nicolas Boichat [Thu, 4 Aug 2016 02:07:54 +0000 (10:07 +0800)]
egl/android: Set dpy->DriverData to NULL on error

Avoid use-after-free on error.

Fixes: 9ee683f877 (egl/dri2: Add reference count for dri2_egl_display)
Cc: "12.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Martin Peres <martin.peres@linux.intel.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
8 years agoegl/drm: Set disp->DriverData to NULL on error
Nicolas Boichat [Thu, 4 Aug 2016 02:07:53 +0000 (10:07 +0800)]
egl/drm: Set disp->DriverData to NULL on error

Avoid use-after-free on error.

Fixes: 9ee683f877 (egl/dri2: Add reference count for dri2_egl_display)
Cc: "12.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Martin Peres <martin.peres@linux.intel.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
8 years agoegl/surfaceless: Set disp->DriverData to NULL on error
Nicolas Boichat [Thu, 4 Aug 2016 02:07:52 +0000 (10:07 +0800)]
egl/surfaceless: Set disp->DriverData to NULL on error

Avoid use-after-free on error.

Fixes: 9ee683f877 (egl/dri2: Add reference count for dri2_egl_display)
Cc: "12.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Martin Peres <martin.peres@linux.intel.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
8 years agoegl/wayland: Set disp->DriverData to NULL on error
Nicolas Boichat [Thu, 4 Aug 2016 02:07:51 +0000 (10:07 +0800)]
egl/wayland: Set disp->DriverData to NULL on error

Avoid use-after-free, fix spec@egl_khr_fence_sync@conformance.

Fixes: 9ee683f877 (egl/dri2: Add reference count for dri2_egl_display)
Cc: "12.0" <mesa-stable@lists.freedesktop.org>
Reported-by: Michel Dänzer <michel@daenzer.net>
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Martin Peres <martin.peres@linux.intel.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
8 years agoegl/x11: avoid using freed memory if dri2 init fails
Jan Ziak [Sun, 31 Jul 2016 13:44:18 +0000 (15:44 +0200)]
egl/x11: avoid using freed memory if dri2 init fails

Found with valgrind:

==4841== Invalid read of size 4
==4841==    at 0x56BDC80: dri2_initialize (egl_dri2.c:783)
==4841==    by 0x56BAFE5: _eglMatchAndInitialize (egldriver.c:261)
==4841==    by 0x56BB15E: _eglMatchDriver (egldriver.c:295)
==4841==    by 0x56B58C9: eglInitialize (eglapi.c:480)
==4841==    by 0x4F537DC: _glfwInitEGL (in /usr/lib64/libglfw.so.3.2)
==4841==    by 0x4F4BEFB: _glfwPlatformInit (in /usr/lib64/libglfw.so.3.2)
==4841==    by 0x4F46F40: glfwInit (in /usr/lib64/libglfw.so.3.2)
==4841==    by 0x402E59: main
==4841==  Address 0x6a05824 is 148 bytes inside a block of size 480 free'd
==4841==    at 0x4C2B680: free (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==4841==    by 0x56C2AAE: dri2_initialize_x11_swrast (platform_x11.c:1233)
==4841==    by 0x56C2AAE: dri2_initialize_x11 (platform_x11.c:1493)
==4841==    by 0x56BDCEB: dri2_initialize (egl_dri2.c:805)
==4841==    by 0x56BAFAF: _eglMatchAndInitialize (egldriver.c:261)
==4841==    by 0x56BB0C9: _eglMatchDriver (egldriver.c:292)
==4841==    by 0x56B58C9: eglInitialize (eglapi.c:480)
==4841==    by 0x4F537DC: _glfwInitEGL (in /usr/lib64/libglfw.so.3.2)
==4841==    by 0x4F4BEFB: _glfwPlatformInit (in /usr/lib64/libglfw.so.3.2)
==4841==    by 0x4F46F40: glfwInit (in /usr/lib64/libglfw.so.3.2)
==4841==    by 0x402E59: main
==4841==  Block was alloc'd at
==4841==    at 0x4C2A868: calloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==4841==    by 0x56C2A47: dri2_initialize_x11_swrast (platform_x11.c:1171)
==4841==    by 0x56C2A47: dri2_initialize_x11 (platform_x11.c:1493)
==4841==    by 0x56BDCEB: dri2_initialize (egl_dri2.c:805)
==4841==    by 0x56BAFAF: _eglMatchAndInitialize (egldriver.c:261)
==4841==    by 0x56BB0C9: _eglMatchDriver (egldriver.c:292)
==4841==    by 0x56B58C9: eglInitialize (eglapi.c:480)
==4841==    by 0x4F537DC: _glfwInitEGL (in /usr/lib64/libglfw.so.3.2)
==4841==    by 0x4F4BEFB: _glfwPlatformInit (in /usr/lib64/libglfw.so.3.2)
==4841==    by 0x4F46F40: glfwInit (in /usr/lib64/libglfw.so.3.2)
==4841==    by 0x402E59: main

Signed-off-by: Jan Ziak (http://atom-symbol.net) <0xe2.0x9a.0x9b@gmail.com>
Fixes: 9ee683f877 (egl/dri2: Add reference count for dri2_egl_display)
Cc: "12.0" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
8 years agoanv: add genX_multisample.h to the sources list(s).
Emil Velikov [Mon, 15 Aug 2016 11:10:47 +0000 (12:10 +0100)]
anv: add genX_multisample.h to the sources list(s).

Otherwise it won't end up in the release tarball.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
8 years agoanv/x11: Add support for Xlib platform
Kevin Strasser [Fri, 12 Aug 2016 21:17:20 +0000 (14:17 -0700)]
anv/x11: Add support for Xlib platform

Some applications continue to use the Xlib client library and expect that
VK_KHR_xlib_surface will be available in the driver. Service these
applications by converting the Display pointer to xcb_connection_t and use
the existing xcb code in the driver.

Signed-off-by: Kevin Strasser <kevin.strasser@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
8 years agoglx: apple specific occurences of dummyContext check
Tapani Pälli [Tue, 7 Jun 2016 10:33:34 +0000 (13:33 +0300)]
glx: apple specific occurences of dummyContext check

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
Cc: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
8 years agoglx: fix error code when there is no context bound
Bernard Kilarski [Tue, 7 Jun 2016 10:33:33 +0000 (13:33 +0300)]
glx: fix error code when there is no context bound

v2: change all related NULL checks to check against dummyContext
v3: really check for dummyContext *only* when ctx was from
    __glXGetCurrentContext
v4: cover more checks, add dummyBuffer, dummyVtable (Emil)

Signed-off-by: Bernard Kilarski <bernard.r.kilarski@intel.com>
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Cc: "11.2" <mesa-stable@lists.freedesktop.org>
8 years agomesa: Remove duplicate include.
Mathias Fröhlich [Sun, 14 Aug 2016 12:03:58 +0000 (14:03 +0200)]
mesa: Remove duplicate include.

In api_validate.c stdbool.h was included twice.

Signed-off-by: Mathias Fröhlich <Mathias.Froehlich@web.de>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
8 years agovbo: Remove always true return from vbo_bind_arrays.
Mathias Fröhlich [Sun, 14 Aug 2016 12:03:58 +0000 (14:03 +0200)]
vbo: Remove always true return from vbo_bind_arrays.

Signed-off-by: Mathias Fröhlich <Mathias.Froehlich@web.de>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
8 years agomesa: Move check for vbo mapping into api_validate.c.
Mathias Fröhlich [Sun, 14 Aug 2016 12:03:58 +0000 (14:03 +0200)]
mesa: Move check for vbo mapping into api_validate.c.

Instead of checking for mapped buffers in vbo_bind_arrays
do this check in api_validate.c. This additionally
enables printing the draw calls name into the error
string.

Signed-off-by: Mathias Fröhlich <Mathias.Froehlich@web.de>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
8 years agomesa: Move _mesa_all_buffers_are_unmapped to arrayobj.c.
Mathias Fröhlich [Sun, 14 Aug 2016 12:03:58 +0000 (14:03 +0200)]
mesa: Move _mesa_all_buffers_are_unmapped to arrayobj.c.

Move the function to check if all vao buffers are
unmapped into the vao implementation file.
Rename the function to _mesa_all_buffers_are_unmapped.

Signed-off-by: Mathias Fröhlich <Mathias.Froehlich@web.de>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
8 years agovbo: Array draw must not care about glBegin/glEnd vbo mapping.
Mathias Fröhlich [Sun, 14 Aug 2016 12:03:58 +0000 (14:03 +0200)]
vbo: Array draw must not care about glBegin/glEnd vbo mapping.

In array draw do not check if the vertex buffer object that
is used to implement immediate mode glBegin/glEnd is mapped.

Signed-off-by: Mathias Fröhlich <Mathias.Froehlich@web.de>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
8 years agonv50,nvc0: fix depth range when halfz is enabled
Ilia Mirkin [Sat, 13 Aug 2016 01:40:52 +0000 (21:40 -0400)]
nv50,nvc0: fix depth range when halfz is enabled

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97231
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "11.2 12.0" <mesa-stable@lists.freedesktop.org>
8 years agogallium/util: add helper to compute zmin/zmax for a viewport state
Ilia Mirkin [Sun, 14 Aug 2016 17:01:45 +0000 (13:01 -0400)]
gallium/util: add helper to compute zmin/zmax for a viewport state

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Cc: "11.2 12.0" <mesa-stable@lists.freedesktop.org>
8 years agovbo: allow DrawElementsBaseVertex in display lists
Ilia Mirkin [Sun, 14 Aug 2016 06:28:35 +0000 (02:28 -0400)]
vbo: allow DrawElementsBaseVertex in display lists

Looks like it was missed originally. The multi version is there already.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97331
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Cc: mesa-stable@lists.freedesktop.org
8 years agofreedreno/a3xx+a4xx: move common VBOs to fd_context
Rob Clark [Sat, 13 Aug 2016 15:39:25 +0000 (11:39 -0400)]
freedreno/a3xx+a4xx: move common VBOs to fd_context

These are the same for a3xx and later.  (a2xx could probably use them
too, but due to limited hw support and ancient downstream kernels, it
isn't so easy to test.)

Signed-off-by: Rob Clark <robdclark@gmail.com>
8 years agofreedreno/a2xx: add missing casts to silence notices
francians@gmail.com [Tue, 9 Aug 2016 17:38:32 +0000 (19:38 +0200)]
freedreno/a2xx: add missing casts to silence notices

Signed-off-by: Francesco Ansanelli <francians@gmail.com>
Signed-off-by: Rob Clark <robdclark@gmail.com>
8 years agofreedreno/ir3: fix issue with emit_tex()
Rob Clark [Thu, 11 Aug 2016 17:27:37 +0000 (13:27 -0400)]
freedreno/ir3: fix issue with emit_tex()

For various tex fetch instructions, coord's get fixed up in different
ways.  But modifying the array returned from get_src() has side-effects
if the same SSA src is used again.. the later instruction will see the
previous fixups.

Fix this, and const'ify things to prevent this sort of mistake in the
future.

Noticed by Varad when adding support for txf_ms.

Signed-off-by: Rob Clark <robdclark@gmail.com>
8 years agoglsl: emit a specific error when ast_*_assign changes type
Ilia Mirkin [Sat, 9 Jul 2016 03:28:22 +0000 (23:28 -0400)]
glsl: emit a specific error when ast_*_assign changes type

For regular ast_add, we can implicitly change either a or b's type.
However in an assignment situation, the type of the lvalue is fixed. So
if the implicit conversion logic decides to change it, it means that the
rhs's type could not be converted to the lhs type.

Emit a specific error for this rather than the rather mysterious "is not
an lvalue" error that results from having a i2f or other operation as
the lvalue.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=96729
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
8 years agost/mesa: provide GL_OES_copy_image support by caching the original ETC data
Ilia Mirkin [Fri, 8 Jul 2016 06:44:57 +0000 (02:44 -0400)]
st/mesa: provide GL_OES_copy_image support by caching the original ETC data

The additional provision of GL_OES_copy_image is that it work for ETC.
However many desktop GPUs don't have native ETC support, so st/mesa does
the decoding by hand. Instead of discarding the compressed data, keep it
around in CPU memory. Use it when performing image copies.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Acked-by: Marek Olšák <marek.olsak@amd.com>
8 years agost/mesa: refactor duplicated etc fallback checks
Ilia Mirkin [Fri, 8 Jul 2016 03:59:03 +0000 (23:59 -0400)]
st/mesa: refactor duplicated etc fallback checks

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agoglsl: look for frag data bindings with [0] tacked onto the end for arrays
Ilia Mirkin [Wed, 6 Jul 2016 23:35:16 +0000 (19:35 -0400)]
glsl: look for frag data bindings with [0] tacked onto the end for arrays

The GL spec is very unclear on this point. Apparently this is discussed
without resolution in the closed Khronos bugtracker at
https://cvs.khronos.org/bugzilla/show_bug.cgi?id=7829 . The
recommendation is to allow dropping the [0] for looking up the bindings.

The approach taken in this patch is to instead tack on [0]'s for each
arrayness level of the output's type, and doing the lookup again. That
way, for

out vec4 foo[2][2][2]

we will end up looking for bindings for foo, foo[0], foo[0][0], and
foo[0][0][0], in that order of preference.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=96765
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Eric Anholt <eric@anholt.net>
8 years agoanv: pipeline: gen7: fix assert in debug mode
Lionel Landwerlin [Thu, 11 Aug 2016 17:25:09 +0000 (18:25 +0100)]
anv: pipeline: gen7: fix assert in debug mode

SampleMask is only 8bits long on gen7.

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

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
8 years agomesa: change state query return value for RGB565
Haixia Shi [Fri, 12 Aug 2016 22:34:09 +0000 (15:34 -0700)]
mesa: change state query return value for RGB565

The GL_BGR and GL_UNSIGNED_SHORT_5_6_5_REV are not defined anywhere in
OpenGL ES 3.2 (or earlier) specification, and there are no known extensions
in the Khronos registry that would add these enums as valid responses for
glGetIntegerv(GL_IMPLEMENTATION_COLOR_READ_TYPE) and
glGetIntegerv(GL_IMPLEMENTATION_COLOR_READ_FORMAT) queries.

Note that this patch does not change the bit layout returned by the query. As
defined by the GL spec, the bit layout of GL_RGB + GL_UNSIGNED_SHORT_5_6_5 and
GL_BGR + GL_UNSIGNED_SHORT_5_6_5_REV are identical.

TEST=dEQP-GLES3.functional.state_query.integers.*

Signed-off-by: Haixia Shi <hshi@chromium.org>
Reviewed-by: Chad Versace <chadversary@chromium.org>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Cc: Stéphane Marchesin <marcheu@chromium.org>
Change-Id: I81bbc8ccdc7e125edaeae443baf6fa8fdefcc6b6

8 years agoanv/device: Add limits for InterpolationOffset
Anuj Phogat [Fri, 29 Jul 2016 00:37:20 +0000 (17:37 -0700)]
anv/device: Add limits for InterpolationOffset

Fixes the vulkan cts regression in test dEQP-VK.api.info.device.properties

Cc: Mark Janes <mark.a.janes@intel.com>
Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agoi965: Change 8X MSAA sample mapping
Anuj Phogat [Thu, 11 Aug 2016 19:05:45 +0000 (12:05 -0700)]
i965: Change 8X MSAA sample mapping

This is required following the change in 8X sample positions.
Fixes the recently modified multisample-scaled-blit piglit tests.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agoi965: Change 8x multisample positions
Anuj Phogat [Tue, 9 Aug 2016 22:41:24 +0000 (15:41 -0700)]
i965: Change 8x multisample positions

There are no standard sample positions defined in OpenGL and OpenGL
ES specs. Implementations have the freedom to pick the positions
which give plausible results. But the Vulkan 1.0 spec does define
standard sample positions for different sample counts. Defined
positions in Vulkan for all the sample counts except 8X match with
the positions we set in i965. We have an upcoming plan to share the
blorp code between OpenGL and Vulkan driver in near future. Keeping
the 8X sample positions same on both the drivers will help us move
in that direction.

Here is an argument by Neil Roberts (from commit 20250e85) against
any advantage of current 8X sample positions over the new ones:

"The comment above for the 8x sample positions says that the hardware
implements centroid interpolation by picking the centre-most sample
that is inside the primitive. That implies that it might be worthwhile
to pick a pattern that includes 0.5,0.5. However by experimentation
this doesn't seem to actually be the case. With the sample positions
in this patch, if I modify the piglit test below so that it instead
reports the centroid position, it reports 0.492188,0.421875 which
doesn't match any of the positions. If I modify the sample positions
so that they include one at exactly 0.5,0.5 it doesn't help and it
reports another position which is even further from the center for
some reason.

arb_gpu_shader5-interpolateAtSample-different

Kenneth Graunke experimented with some other patterns that have a
higher standard deviation but I think after some discussion it was
decided that it would be better to pick the same pattern as the other
graphics API in case there are games that rely on this pattern."

Observed no regressions in jenkins testing.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agoanv: Use macro to avoid code duplication for sample positions
Anuj Phogat [Wed, 10 Aug 2016 22:22:10 +0000 (15:22 -0700)]
anv: Use macro to avoid code duplication for sample positions

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agost/mesa: BufferData should flag NewDriverState
Marek Olšák [Sun, 7 Aug 2016 00:45:30 +0000 (02:45 +0200)]
st/mesa: BufferData should flag NewDriverState

because NewDriverState is filtered depending on active shader states,
while st->dirty isn't.

Tested-by: Edmondo Tommasina <edmondo.tommasina@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agost/mesa: don't update atomic, SSBO, UBO and TBO states that have no effect
Marek Olšák [Tue, 2 Aug 2016 16:38:45 +0000 (18:38 +0200)]
st/mesa: don't update atomic, SSBO, UBO and TBO states that have no effect

Tested-by: Edmondo Tommasina <edmondo.tommasina@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agost/mesa: _NEW_TEXTURE & CONSTANTS shouldn't flag states that aren't used
Marek Olšák [Tue, 2 Aug 2016 14:59:41 +0000 (16:59 +0200)]
st/mesa: _NEW_TEXTURE & CONSTANTS shouldn't flag states that aren't used

Tested-by: Edmondo Tommasina <edmondo.tommasina@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agost/mesa: when changing shaders, only dirty states that are affected by them
Marek Olšák [Tue, 2 Aug 2016 14:40:50 +0000 (16:40 +0200)]
st/mesa: when changing shaders, only dirty states that are affected by them

This reduces the amount of state processing that has no effect.

Tested-by: Edmondo Tommasina <edmondo.tommasina@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agost/mesa: determine states used or affected by shaders at compile time
Marek Olšák [Tue, 2 Aug 2016 14:40:50 +0000 (16:40 +0200)]
st/mesa: determine states used or affected by shaders at compile time

At compile time, each shader determines which ST_NEW flags should be set
at shader bind time.

This just sets the new field for all shaders. The next commit will use it.

v2: small code unification

Tested-by: Edmondo Tommasina <edmondo.tommasina@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com> (v1)
8 years agost/mesa: remove TES/TCS/GS state dirtying optimization
Marek Olšák [Tue, 2 Aug 2016 16:40:20 +0000 (18:40 +0200)]
st/mesa: remove TES/TCS/GS state dirtying optimization

This will be replaced with a better mechanism.

Tested-by: Edmondo Tommasina <edmondo.tommasina@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agost/mesa: don't update clip state on VS changes if it has no effect
Marek Olšák [Tue, 2 Aug 2016 13:26:19 +0000 (15:26 +0200)]
st/mesa: don't update clip state on VS changes if it has no effect

Tested-by: Edmondo Tommasina <edmondo.tommasina@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agost/mesa: don't update clip state if it has no effect
Marek Olšák [Tue, 2 Aug 2016 13:17:27 +0000 (15:17 +0200)]
st/mesa: don't update clip state if it has no effect

Tested-by: Edmondo Tommasina <edmondo.tommasina@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agomesa: Document that _mesa_enum_to_string() returns non-null (v2)
Chad Versace [Thu, 11 Aug 2016 15:28:57 +0000 (08:28 -0700)]
mesa: Document that _mesa_enum_to_string() returns non-null (v2)

It always returns non-null, even if the number is an invalid enum.

Cc: Haixia Shi <hshi@chromium.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Change-Id: I26e8843c96130be972e66f48a49e362442e1bf97

8 years agoglsl: Fix invariant matching in GLSL 4.30 and GLSL ES 1.00.
Kenneth Graunke [Thu, 11 Aug 2016 13:12:53 +0000 (06:12 -0700)]
glsl: Fix invariant matching in GLSL 4.30 and GLSL ES 1.00.

Old languages (GLSL <= 4.20 and GLSL ES 1.00) require "invariant"
to be specified on both inputs and outputs, and match when linking.

New languages only allow outputs to be qualified as "invariant"
and remove the "invariant must match" restriction when linking
varyings (because no input can have that qualifier).

Commit 426a50e2089b12d33f5c075aa5622f64076914a3 introduced the new
behavior for ES 3.00.  It also removed the "must match" restriction
for ES 1.00 shaders, which I believe is incorrect.  This patch adds
that back, as well as making 4.30+ follow the new rules.

Thanks to Qiankun Miao for noticing this discrepancy.

Fixes a WebGL 2.0 conformance test when run in Chromium:
https://www.khronos.org/registry/webgl/sdk/tests/deqp/data/gles3/shaders/qualification_order.html?webglVersion=2

Cc: mesa-stable@lists.freedesktop.org
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=96971
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
8 years agoglsl: Tidy stream handling in merge_qualifier().
Kenneth Graunke [Thu, 11 Aug 2016 18:44:09 +0000 (11:44 -0700)]
glsl: Tidy stream handling in merge_qualifier().

The previous commit fixed xfb_buffer handling, which was largely copy
and pasted from the stream handling.  The difference is that stream
was set in input_layout_mask, so it worked.

However, that's totally rubbish: stream is only valid on geometry shader
outputs.  Presumably this was to hack around inout.  Instead, apply the
solution I used in the previous fix.

Really, we just need to separate shader interface and parameter
qualifier handling so this isn't a mess, but this patch at least
tidies it slightly.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
8 years agoglsl: Fix inout qualifier handling in GLSL 4.40.
Kenneth Graunke [Thu, 11 Aug 2016 18:40:25 +0000 (11:40 -0700)]
glsl: Fix inout qualifier handling in GLSL 4.40.

inout variables have q.in and q.out set.  We were trying to set
xfb_buffer = 1 for shader output variables (and inadvertantly setting
it on inout parameters, too).  But input_layout_mask doesn't have
xfb_buffer set, so it was seen as in invalid input qualifier.

This meant that all 'inout' parameters were broken.

Caught by running a WebGL conformance test in Chromium:
https://www.khronos.org/registry/webgl/sdk/tests/deqp/data/gles3/shaders/qualification_order.html?webglVersion=2

Fixes Piglit's tests/spec/glsl-4.40/compiler/inout-parameter-qualifier.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
8 years agoswrast: fix active attribs with atifragshader
Miklós Máté [Sun, 26 Jun 2016 19:48:00 +0000 (13:48 -0600)]
swrast: fix active attribs with atifragshader

Only include the ones that can be used by the shader.

This fixes texture coordinates, which were completely wrong,
because WPOS was included in the list of attribs. It also
increases performance noticeably.

Signed-off-by: Miklós Máté <mtmkls@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
8 years agost/omx/dec/h264: pass default scaling lists in raster format
Indrajit Das [Tue, 9 Aug 2016 05:13:13 +0000 (10:43 +0530)]
st/omx/dec/h264: pass default scaling lists in raster format

Tested-by: Leo Liu <leo.liu@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
8 years agoappveyor: Force Visual Studio 2013 image.
Jose Fonseca [Thu, 11 Aug 2016 13:11:00 +0000 (14:11 +0100)]
appveyor: Force Visual Studio 2013 image.

It seems the default build image is now Visual Studio 2015, and Visual
Studio 2013 is not installed.

8 years agoappveyor: Install pywin32 extensions.
Jose Fonseca [Thu, 11 Aug 2016 13:00:35 +0000 (14:00 +0100)]
appveyor: Install pywin32 extensions.

AppVeyor build images seem to have been upgraded to Python 2.7.12, but
no longer have pywin32 pre-installed.

8 years agoglsl/tests: fix segfault in uniform initializer test
Timothy Arceri [Thu, 11 Aug 2016 00:34:52 +0000 (10:34 +1000)]
glsl/tests: fix segfault in uniform initializer test

Caused by 549222f5

Tested-by: Aaron Watry <awatry@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97286

8 years agoglcpp: Only disallow #undef of pre-defined macros on GLSL ES >= 3.00 shaders
Ian Romanick [Tue, 9 Aug 2016 21:32:24 +0000 (14:32 -0700)]
glcpp: Only disallow #undef of pre-defined macros on GLSL ES >= 3.00 shaders

Section 3.4 (Preprocessor) of the GLSL ES 3.00 spec says:

   It is an error to undefine or to redefine a built-in (pre-defined)
   macro name.

The GLSL ES 1.00 spec does not contain this text.

Section 3.3 (Preprocessor) of the GLSL 1.30 spec says:

   #define and #undef functionality are defined as is standard for C++
   preprocessors for macro definitions both with and without macro
   parameters.

At least as far as I can tell GCC allow '#undef __FILE__'.  Furthermore,
there are desktop OpenGL conformance tests that expect '#undef
__VERSION__' and '#undef GL_core_profile' to work.

Fixes:

    GL45-CTS.shaders.preprocessor.definitions.undefine_version_vertex
    GL45-CTS.shaders.preprocessor.definitions.undefine_version_fragment
    GL45-CTS.shaders.preprocessor.definitions.undefine_core_profile_vertex
    GL45-CTS.shaders.preprocessor.definitions.undefine_core_profile_fragment

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
Cc: mesa-stable@lists.freedesktop.org
8 years agoglcpp: Track the actual version instead of just the version_resolved flag
Ian Romanick [Tue, 9 Aug 2016 21:31:49 +0000 (14:31 -0700)]
glcpp: Track the actual version instead of just the version_resolved flag

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
Cc: mesa-stable@lists.freedesktop.org