mesa.git
8 years agost/mesa: simplify some code in get_texture_format_swizzle()
Brian Paul [Fri, 23 Sep 2016 18:18:46 +0000 (12:18 -0600)]
st/mesa: simplify some code in get_texture_format_swizzle()

There's no need to cast to st_texture_image.  Just use gl_texture_image.

Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agomesa: make _mesa_texture_buffer_range() static
Brian Paul [Fri, 23 Sep 2016 18:59:56 +0000 (12:59 -0600)]
mesa: make _mesa_texture_buffer_range() static

Not called from any other file.  Also, add a comment.

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
8 years agomesa: add const qualifier, comment on can_avoid_reallocation()
Brian Paul [Sat, 24 Sep 2016 13:33:59 +0000 (07:33 -0600)]
mesa: add const qualifier, comment on can_avoid_reallocation()

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
8 years agomesa: add comment/assertion on get_tex_level_parameter_buffer()
Brian Paul [Fri, 23 Sep 2016 18:59:29 +0000 (12:59 -0600)]
mesa: add comment/assertion on get_tex_level_parameter_buffer()

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
8 years agonir: Remove some no longer needed asserts
Jason Ekstrand [Thu, 6 Oct 2016 02:56:54 +0000 (19:56 -0700)]
nir: Remove some no longer needed asserts

Now that the NIR casting functions have type assertions, we have a bunch of
assertions that aren't needed anymore.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
8 years agonir: Make nir_foo_first/last_cf_node return a block instead
Jason Ekstrand [Thu, 6 Oct 2016 02:08:57 +0000 (19:08 -0700)]
nir: Make nir_foo_first/last_cf_node return a block instead

One of NIR's invariants is that control flow lists always start and end
with blocks.  There's no good reason why we should return a cf_node from
these functions since we know that it's always a block.  Making it a block
lets us remove a bunch of code.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
8 years agonir: Add asserts to the casting functions
Jason Ekstrand [Thu, 6 Oct 2016 01:09:25 +0000 (18:09 -0700)]
nir: Add asserts to the casting functions

This makes calling nir_foo_as_bar a bit safer because we're no longer 100%
trusting in the caller to ensure that it's safe.  The caller still needs to
do the right thing but this ensures that we catch invalid casts with an
assert rather than by reading garbage data.  The one downside is that we do
use the casts a bit in nir_validate and it's not a validate_assert.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
8 years agogallium/hud: Remove superfluous debug
Steven Toth [Thu, 6 Oct 2016 15:26:51 +0000 (11:26 -0400)]
gallium/hud: Remove superfluous debug

No longer required.

Signed-off-by: Steven Toth <stoth@kernellabs.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
8 years agoamd: add amd_kernel_code_t.h to the sources list
Emil Velikov [Thu, 6 Oct 2016 14:42:04 +0000 (15:42 +0100)]
amd: add amd_kernel_code_t.h to the sources list

Otherwise it won't be picked in the tarball and the build will fail.

Fixes: 91ec6e56649 ("radeonsi/compute: Use the HSA abi for non-TGSI
compute shaders v3")
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
8 years agosvga: add svga_mksstats.h to the sources list
Emil Velikov [Thu, 6 Oct 2016 14:21:58 +0000 (15:21 +0100)]
svga: add svga_mksstats.h to the sources list

Otherwise it won't be picked in the tarball and the build will fail.

Fixes: 0035f7f1365 ("svga: add guest statistic gathering interface")
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
8 years agoglx: rename choose_visual(), drop const argument
Emil Velikov [Fri, 30 Sep 2016 10:01:28 +0000 (11:01 +0100)]
glx: rename choose_visual(), drop const argument

The function deals with fb (style) configs, thus using "visual"
in the name is misleading. Which in itself had led to the use of
fbconfig_style_tags argument.

Rename the function to reflect what it does and drop the unneeded
argument.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agoglx: return GL_FALSE from glx_screen_init where applicable.
Emil Velikov [Fri, 30 Sep 2016 10:01:27 +0000 (11:01 +0100)]
glx: return GL_FALSE from glx_screen_init where applicable.

Return GL_FALSE if we fail to find any fb/visual configs, otherwise we
end up with all sorts of chaos further down the GLX stack.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agoglx: correctly mask the drawableType for GLX_ARB_fbconfig_float
Emil Velikov [Fri, 30 Sep 2016 10:01:26 +0000 (11:01 +0100)]
glx: correctly mask the drawableType for GLX_ARB_fbconfig_float

The comment/spec says - only for pbuffer drawables, while the code
clears the window/pixmap bit. Practise what you preach and apply the
trivial tweak. In practise this should not cause functional change.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agoautoconf: Make header install distinct for various APIs (v2)
Chuck Atkins [Tue, 4 Oct 2016 15:05:30 +0000 (11:05 -0400)]
autoconf: Make header install distinct for various APIs (v2)

This fixes a problem where GL headers would only get installed if
glx was enabled.  So if osmesa was enabled but not glx, then the
GL headers required by osmesa would be missing from the install.

v2: Dropped unneeded mesa_glinterop.h redundant osmesa.h install

Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Chuck Atkins <chuck.atkins@kitware.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
8 years agomesa: annotate AttribFuncsARB[] as const
Emil Velikov [Thu, 25 Aug 2016 15:59:01 +0000 (16:59 +0100)]
mesa: annotate AttribFuncsARB[] as const

It's read-only data, so annotate it accordingly.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
8 years agomapi/glapi: remove unused _glapi_check_table()
Emil Velikov [Thu, 25 Aug 2016 15:59:00 +0000 (16:59 +0100)]
mapi/glapi: remove unused _glapi_check_table()

Similar to earlier commit - symbol was never part of the public API so
we're safe to remove it.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
8 years agoglapi/hgl: remove the final user of _glapi_check_table()
Emil Velikov [Thu, 25 Aug 2016 15:58:59 +0000 (16:58 +0100)]
glapi/hgl: remove the final user of _glapi_check_table()

The symbol is a no-op since, the EXTRA_DEBUG macro is not set in the
build. Unused by !Haiku people/platforms since 2010 (commit
a73c6540d9a7f6e26d8568ba2fc522cb865f0a6c) while the Haiku C++ wrapper
has no obvious users.

Cc: Alexander von Gluck IV <kallisti5@unixzen.com>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
8 years agomapi/glapi: remove unused _glapi_check_table_not_null
Emil Velikov [Thu, 25 Aug 2016 15:58:58 +0000 (16:58 +0100)]
mapi/glapi: remove unused _glapi_check_table_not_null

Function was never part of the API/ABI and the final user was removed
with commit a73c6540d9a7f6e26d8568ba2fc522cb865f0a6c, back in 2010.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
8 years agost/xvmc/tests: force enable assertions
Emil Velikov [Mon, 19 Sep 2016 14:35:32 +0000 (15:35 +0100)]
st/xvmc/tests: force enable assertions

Similar to the other 'tests', enable assertions in xvmc_bench.

This silences the GCC warnings about unused-variable(s), makes the
program actually useful, as the XvMC API called. Atm the function
calls are omitted, since they're called within the assert.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
8 years agoanv: automake: ship intel_icd.json.in in the tarball
Emil Velikov [Mon, 19 Sep 2016 12:14:39 +0000 (13:14 +0100)]
anv: automake: ship intel_icd.json.in in the tarball

Otherwise we'll fail to (re)generate intel_icd.json.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
8 years agointel: automake: reference the correct header
Emil Velikov [Mon, 19 Sep 2016 11:46:37 +0000 (12:46 +0100)]
intel: automake: reference the correct header

The header was renamed with earlier commit, so update the
Makefile.sources respectively.

{vulkan/genX_multisample.h => common/gen_sample_positions.h}

Fixes: c779ad3e661("intel: Move Vulkan sample positions to common code")
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
8 years agointel: aubinator: add missing return characters
Lionel Landwerlin [Tue, 4 Oct 2016 15:28:43 +0000 (16:28 +0100)]
intel: aubinator: add missing return characters

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agonir: Delete open coded type printing.
Kenneth Graunke [Wed, 5 Oct 2016 18:58:59 +0000 (11:58 -0700)]
nir: Delete open coded type printing.

glsl_print_type() prints arrays of arrays incorrectly.  For example,
a type with name float[3][7] would be printed as float[7][3].  (This
is an array of length 3 containing arrays of 7 floats.)  cdecl says
that the type name is correct.

glsl_print_type() doesn't really do anything above and beyond printing
type->name, and glsl_print_struct() wasn't used at all.  So, drop them.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
8 years agoanv: fix GetPhysicalDeviceProperties to return timestampPeriod in ns
Philipp Zabel [Wed, 5 Oct 2016 23:48:04 +0000 (01:48 +0200)]
anv: fix GetPhysicalDeviceProperties to return timestampPeriod in ns

According to chapters 16.5. (Timestamp Queries) and 30.2 (Limits) of the
Vulkan Specification 1.0.29, the .limits.timestampPeriod field returned
by vkGetPhysicalDeviceProperties is measured in nanoseconds, not in
seconds.

Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoi965: remove remaining tabs in brw_draw.c
Timothy Arceri [Wed, 5 Oct 2016 05:46:39 +0000 (16:46 +1100)]
i965: remove remaining tabs in brw_draw.c

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoi965: get inputs read from nir info
Timothy Arceri [Wed, 5 Oct 2016 05:45:27 +0000 (16:45 +1100)]
i965: get inputs read from nir info

This is a step towards dropping the GLSL IR version of
do_set_program_inouts() in i965 and moving towards native nir support.

This is important because we want to eventually convert to nir and
use its optimisations passes before we can call this GLSL IR pass.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoi965: get outputs written from nir info
Timothy Arceri [Wed, 5 Oct 2016 05:24:56 +0000 (16:24 +1100)]
i965: get outputs written from nir info

This is a step towards dropping the GLSL IR version of
do_set_program_inouts() in i965 and moving towards native nir support.

This is important because we want to eventually convert to nir and
use its optimisations passes before we can call this GLSL IR pass.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoi965: get outputs read from nir info
Timothy Arceri [Wed, 5 Oct 2016 04:56:21 +0000 (15:56 +1100)]
i965: get outputs read from nir info

This is a step towards dropping the GLSL IR version of
do_set_program_inouts() in i965 and moving towards native nir support.

This is important because we want to eventually convert to nir and
use its optimisations passes before we can call this GLSL IR pass.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoi965: remove remaining tabs in brw_wm.c
Timothy Arceri [Wed, 5 Oct 2016 04:42:02 +0000 (15:42 +1100)]
i965: remove remaining tabs in brw_wm.c

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agomesa: remove the UsesDFdy flag
Timothy Arceri [Wed, 5 Oct 2016 04:28:50 +0000 (15:28 +1100)]
mesa: remove the UsesDFdy flag

Seems the last user of this was removed in 08bc74e69.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoi965: get uses discard from nir info
Timothy Arceri [Wed, 5 Oct 2016 04:13:23 +0000 (15:13 +1100)]
i965: get uses discard from nir info

This is a step towards dropping the GLSL IR version of
do_set_program_inouts() in i965 and moving towards native nir support.

This is important because we want to eventually convert to nir and
use its optimisations passes before we can call this GLSL IR pass.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoi965: get uses texture gather from nir info
Timothy Arceri [Wed, 5 Oct 2016 03:57:21 +0000 (14:57 +1100)]
i965: get uses texture gather from nir info

This is a step towards dropping the GLSL IR version of
do_set_program_inouts() in i965 and moving towards native nir support.

This is important because we want to eventually convert to nir and
use its optimisations passes before we can call this GLSL IR pass.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoi965: Eliminate brw->cs.prog_data pointer.
Kenneth Graunke [Fri, 9 Sep 2016 06:48:53 +0000 (23:48 -0700)]
i965: Eliminate brw->cs.prog_data pointer.

Just say no to:

-   brw->cs.base.prog_data = &brw->cs.prog_data->base.base;

We'll just use the brw_stage_prog_data pointer in brw_stage_state
and downcast it to brw_cs_prog_data as needed.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Timothy Arceri <timothy.arcero@collabora.com>
8 years agoi965: Eliminate brw->wm.prog_data pointer.
Kenneth Graunke [Fri, 9 Sep 2016 06:48:53 +0000 (23:48 -0700)]
i965: Eliminate brw->wm.prog_data pointer.

Just say no to:

-   brw->wm.base.prog_data = &brw->wm.prog_data->base.base;

We'll just use the brw_stage_prog_data pointer in brw_stage_state
and downcast it to brw_wm_prog_data as needed.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Timothy Arceri <timothy.arcero@collabora.com>
8 years agoi965: Eliminate brw->gs.prog_data pointer.
Kenneth Graunke [Fri, 9 Sep 2016 06:48:53 +0000 (23:48 -0700)]
i965: Eliminate brw->gs.prog_data pointer.

Just say no to:

-   brw->gs.base.prog_data = &brw->gs.prog_data->base.base;

We'll just use the brw_stage_prog_data pointer in brw_stage_state
and downcast it to brw_gs_prog_data as needed.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Timothy Arceri <timothy.arcero@collabora.com>
8 years agoi965: Eliminate brw->tes.prog_data pointer.
Kenneth Graunke [Fri, 9 Sep 2016 06:48:53 +0000 (23:48 -0700)]
i965: Eliminate brw->tes.prog_data pointer.

Just say no to:

-   brw->tes.base.prog_data = &brw->tes.prog_data->base.base;

We'll just use the brw_stage_prog_data pointer in brw_stage_state
and downcast it to brw_tes_prog_data as needed.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Timothy Arceri <timothy.arcero@collabora.com>
8 years agoi965: Eliminate brw->tcs.prog_data pointer.
Kenneth Graunke [Fri, 9 Sep 2016 06:48:53 +0000 (23:48 -0700)]
i965: Eliminate brw->tcs.prog_data pointer.

Just say no to:

-   brw->tcs.base.prog_data = &brw->tcs.prog_data->base.base;

We'll just use the brw_stage_prog_data pointer in brw_stage_state
and downcast it to brw_tcs_prog_data as needed.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Timothy Arceri <timothy.arcero@collabora.com>
8 years agoi965: Eliminate brw->vs.prog_data pointer.
Kenneth Graunke [Fri, 9 Sep 2016 06:48:53 +0000 (23:48 -0700)]
i965: Eliminate brw->vs.prog_data pointer.

Just say no to:

-   brw->vs.base.prog_data = &brw->vs.prog_data->base.base;

We'll just use the brw_stage_prog_data pointer in brw_stage_state
and downcast it to brw_vs_prog_data as needed.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Timothy Arceri <timothy.arcero@collabora.com>
8 years agoi965: Introduce downcast helpers for prog_data structures.
Kenneth Graunke [Fri, 9 Sep 2016 06:48:51 +0000 (23:48 -0700)]
i965: Introduce downcast helpers for prog_data structures.

Similar to brw_context(...), intel_texture_object(...), and so on.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Timothy Arceri <timothy.arcero@collabora.com>
8 years agoi965/sync: Rename awkward variable
Chad Versace [Wed, 28 Sep 2016 06:33:46 +0000 (23:33 -0700)]
i965/sync: Rename awkward variable

What is the difference between a 'driver_fence' and a 'fence'? Do the
characters 'driver_' add anything helpful? Nope. They do, though, add an
extra 7 chars and pull your eyeballs away to ask "huh? what's that?" one
microsecond too many.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoi965/sync: Rename intel_syncobj.c -> brw_sync.c
Chad Versace [Wed, 28 Sep 2016 06:33:45 +0000 (23:33 -0700)]
i965/sync: Rename intel_syncobj.c -> brw_sync.c

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoi965/sync: Replace 'intel' prefix with 'brw'
Chad Versace [Wed, 28 Sep 2016 06:33:45 +0000 (23:33 -0700)]
i965/sync: Replace 'intel' prefix with 'brw'

This is yet another patch for the great renaming begun long ago.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoi965/sync: Fix uninitalized usage and leak of mutex
Chad Versace [Wed, 28 Sep 2016 06:33:45 +0000 (23:33 -0700)]
i965/sync: Fix uninitalized usage and leak of mutex

We locked an unitialized mutex in the callstack
    glClientWaitSync
    intel_gl_client_wait_sync
    brw_fence_client_wait_sync
because we forgot to initialize it in intel_gl_fence_sync.
(The EGLSync codepath didn't have this bug. It initialized the mutex in
intel_dri_create_sync).

We also forgot to tear down (mtx_destroy) the mutex when destroying
the sync object.

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agonir: Use the correct infos structure for copying atomic sources
Jason Ekstrand [Wed, 5 Oct 2016 19:12:33 +0000 (12:12 -0700)]
nir: Use the correct infos structure for copying atomic sources

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Tested-by: Mark Janes <mark.a.janes@intel.com>
Cc: "12.0" <mesa-dev@lists.freedestkop.org>
8 years agonvc0: dump program binary when chipset has been forced
Samuel Pitoiset [Sun, 2 Oct 2016 14:59:10 +0000 (16:59 +0200)]
nvc0: dump program binary when chipset has been forced

Currently, program binaries are only dumped at upload time, but
when the chipset has been forced via NV50_PROG_CHIPSET we might
want to show the generated code, especially with shaderdb.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
8 years agoradeonsi: fix texture border colors for compute shaders
Marek Olšák [Tue, 4 Oct 2016 23:49:30 +0000 (01:49 +0200)]
radeonsi: fix texture border colors for compute shaders

There are VM faults without this.

Cc: 12.0 <mesa-stable@lists.freedesktop.org>
Acked-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agogallium/radeon/winsyses: set reasonable max_alloc_size
Marek Olšák [Tue, 4 Oct 2016 21:29:27 +0000 (23:29 +0200)]
gallium/radeon/winsyses: set reasonable max_alloc_size

which is returned for GL_MAX_TEXTURE_BUFFER_SIZE.
It doesn't have any other use at the moment.
Bigger allocations are not rejected.

This fixes GL45-CTS.texture_buffer.texture_buffer_max_size on Bonaire.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agoradeonsi: fix interpolateAt opcodes for .zw components
Marek Olšák [Tue, 4 Oct 2016 20:33:03 +0000 (22:33 +0200)]
radeonsi: fix interpolateAt opcodes for .zw components

Not returning garbage in .zw seems pretty important.

This fixes:
GL45-CTS.shader_multisample_interpolation.render.interpolate_at_*_check.*

Cc: 11.2 12.0 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agoradeonsi: add assertions to validate interpolation flags
Marek Olšák [Tue, 4 Oct 2016 17:53:53 +0000 (19:53 +0200)]
radeonsi: add assertions to validate interpolation flags

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agoradeonsi: interpolate colors after interpolation weight shuffling
Marek Olšák [Tue, 4 Oct 2016 19:08:17 +0000 (21:08 +0200)]
radeonsi: interpolate colors after interpolation weight shuffling

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agotgsi/scan: don't set interp flags for inputs only used by INTERP (v2)
Marek Olšák [Thu, 8 Sep 2016 17:12:00 +0000 (19:12 +0200)]
tgsi/scan: don't set interp flags for inputs only used by INTERP (v2)

(v1 pushed, then reverted)

This fixes 9 randomly failing tests on radeonsi:
  GL45-CTS.shader_multisample_interpolation.render.interpolate_at_centroid.*

v2: use input_interpolate[input] (correct) instead of
    input_interpolate[index] (incorrect)

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agoddebug: dump most driver information with GALLIUM_DDEBUG=always
Marek Olšák [Tue, 4 Oct 2016 22:06:10 +0000 (00:06 +0200)]
ddebug: dump most driver information with GALLIUM_DDEBUG=always

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agonv50/ra: let simplify return an error and handle that
Karol Herbst [Mon, 3 Oct 2016 16:55:09 +0000 (18:55 +0200)]
nv50/ra: let simplify return an error and handle that

fixes a crash in the case simplify reports an error

Signed-off-by: Karol Herbst <karolherbst@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
8 years agointel/blorp: Use documented RECTLIST vertex positions
Nanley Chery [Wed, 5 Oct 2016 16:32:52 +0000 (09:32 -0700)]
intel/blorp: Use documented RECTLIST vertex positions

Use the vertex positions described in the PRMs. This has no effect on
rendering but quiets the simulator warnings seen when the vertices
appear out of order.

Signed-off-by: Nanley Chery <nanley.g.chery@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Ben Widawsky <ben@bwidawsk.net>
8 years agoanv/meta: Roll clear_image into CmdClearDepthStencilImage
Jason Ekstrand [Sun, 25 Sep 2016 16:41:27 +0000 (09:41 -0700)]
anv/meta: Roll clear_image into CmdClearDepthStencilImage

It is now the only caller so there's no sense in keeping things split out.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
8 years agoanv: Use blorp for VkCmdFillBuffer
Jason Ekstrand [Sun, 25 Sep 2016 15:44:40 +0000 (08:44 -0700)]
anv: Use blorp for VkCmdFillBuffer

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
8 years agoegl: Implement EGL_KHR_debug (v2)
Kyle Brenneman [Mon, 12 Sep 2016 21:51:22 +0000 (17:51 -0400)]
egl: Implement EGL_KHR_debug (v2)

Wire up the debug entrypoints to EGL dispatch, and add the extension
string to the client extension list.

v2:
- Lots of style fixes
- Fix missing EGLAPIENTRYs
- Factor out valid attribute check
- Lock display in eglLabelObjectKHR as needed, and use RETURN_EGL_*
- Move "EGL_KHR_debug" into asciibetical order in client extension
  string

Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Emil Velikov <emil.veliko@collabora.com>
8 years agoegl: Track EGL_KHR_debug state when going through EGL API calls (v3)
Kyle Brenneman [Mon, 12 Sep 2016 21:50:40 +0000 (17:50 -0400)]
egl: Track EGL_KHR_debug state when going through EGL API calls (v3)

This decorates every EGL entrypoint with _EGL_FUNC_START, which records
the function name and primary dispatch object label in the current
thread state. It also adds debug report functions and calls them when
appropriate.

This would be useful enough for debugging on its own, if the user set a
breakpoint when the report function was called. We will also need this
state tracked in order to expose EGL_KHR_debug.

v2:
- Clear the object label in more cases in _eglSetFuncName
- Pass draw surface (if any) to _EGL_FUNC_START in eglSwapInterval

v3:
- Set dummy thread's CurrentAPI to EGL_OPENGL_ES_API not zero
- Less ?: in _eglSetFuncName

Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Emil Velikov <emil.veliko@collabora.com>
8 years agointel: aubinator: pack supported generations into an array
Lionel Landwerlin [Tue, 4 Oct 2016 15:17:56 +0000 (16:17 +0100)]
intel: aubinator: pack supported generations into an array

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agoi965/l3: Add explicit way size calculation for bxt
Ben Widawsky [Wed, 5 Oct 2016 03:42:30 +0000 (20:42 -0700)]
i965/l3: Add explicit way size calculation for bxt

There should be no functional change here because Broxton and CHV are
both gt1. Without this code however, it might seem like broxton support
is missing.

While here, put the gt1 check in front to hopefully short-circuit the
condition for the mobile cases.

Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
8 years agovirgl: Fix build regression of commit 8a943564
Nicolai Hähnle [Wed, 5 Oct 2016 14:27:29 +0000 (16:27 +0200)]
virgl: Fix build regression of commit 8a943564

8 years agost/mesa: enable GL_KHR_robustness
Nicolai Hähnle [Wed, 28 Sep 2016 08:54:34 +0000 (10:54 +0200)]
st/mesa: enable GL_KHR_robustness

The difference to the virtually identical ARB_robustness (which is already
enabled unconditionally) is miniscule and handled elsewhere, but this cap
seems like the right thing to require for this extension.

v2: drop the device reset cap requirement (Ilia)

Reviewed-by: Marek Olšák <marek.olsak@amd.com> (v1)
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
8 years agogallium/radeon: implement set_device_reset_callback
Nicolai Hähnle [Fri, 30 Sep 2016 13:21:00 +0000 (15:21 +0200)]
gallium/radeon: implement set_device_reset_callback

Check for device reset on flush. It would be nicer if the kernel just
reported this as an error on the submit ioctl (and similarly for fences),
but this will do for now.

Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agost/mesa: set a device reset callback when available
Nicolai Hähnle [Fri, 30 Sep 2016 12:06:04 +0000 (14:06 +0200)]
st/mesa: set a device reset callback when available

Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agost/mesa: extract conversion from pipe_reset_status to GLenum
Nicolai Hähnle [Fri, 30 Sep 2016 11:02:00 +0000 (13:02 +0200)]
st/mesa: extract conversion from pipe_reset_status to GLenum

Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agoddebug: add pass-through of set_device_reset_callback
Nicolai Hähnle [Fri, 30 Sep 2016 10:53:00 +0000 (12:53 +0200)]
ddebug: add pass-through of set_device_reset_callback

Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agogallium: add pipe_context::set_device_reset_callback
Nicolai Hähnle [Fri, 30 Sep 2016 10:32:02 +0000 (12:32 +0200)]
gallium: add pipe_context::set_device_reset_callback

Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agovirgl: use the new parent/child pools for transfers
Nicolai Hähnle [Tue, 27 Sep 2016 17:12:24 +0000 (19:12 +0200)]
virgl: use the new parent/child pools for transfers

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agovc4: use the new parent/child pools for transfers
Nicolai Hähnle [Tue, 27 Sep 2016 17:09:24 +0000 (19:09 +0200)]
vc4: use the new parent/child pools for transfers

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agofreedreno: use the new parent/child pools for transfers
Nicolai Hähnle [Tue, 27 Sep 2016 17:06:13 +0000 (19:06 +0200)]
freedreno: use the new parent/child pools for transfers

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agor300: use the new parent/child pools for transfers (v2)
Nicolai Hähnle [Tue, 27 Sep 2016 16:59:56 +0000 (18:59 +0200)]
r300: use the new parent/child pools for transfers (v2)

v2: slab_alloc_st -> slab_alloc

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agogallium/radeon: use the new parent/child pools for transfers
Nicolai Hähnle [Tue, 27 Sep 2016 16:53:45 +0000 (18:53 +0200)]
gallium/radeon: use the new parent/child pools for transfers

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97894
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agoutil/slab: re-design to allow migration between pools (v3)
Nicolai Hähnle [Tue, 27 Sep 2016 16:30:18 +0000 (18:30 +0200)]
util/slab: re-design to allow migration between pools (v3)

This is basically a re-write of the slab allocator into a design where
multiple child pools are linked to a parent pool. The intention is that
every (GL, pipe) context has its own child pool, while the corresponding
parent pool is held by the winsys or screen, or possibly the GL share group.

The fast path is still used when objects are freed by the same child pool
that allocated them. However, it is now also possible to free an object in a
different pool, as long as they belong to the same parent. Objects also
survive the destruction of the (child) pool from which they were allocated.

The slow path will return freed objects to the child pool from which they
were originally allocated. If that child pool was destroyed, the corresponding
page is considered an orphan and will be freed once all objects in it have
been freed.

This allocation pattern is required for pipe_transfers that correspond to
(GL) buffer object mappings when the mapping is created in one context
which is later destroyed while other contexts of the same share group live
on -- see the bug report referenced below.

Note that individual drivers do need to migrate to the new interface in
order to benefit and fix the bug.

v2: use singly-linked lists everywhere
v3: use p_atomic_set for page->u.num_remaining

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

8 years agoutil: use GCC atomic intrinsics with explicit memory model
Nicolai Hähnle [Tue, 4 Oct 2016 14:06:31 +0000 (16:06 +0200)]
util: use GCC atomic intrinsics with explicit memory model

This is motivated by the fact that p_atomic_read and p_atomic_set may
somewhat surprisingly not do the right thing in the old version: while
stores and loads are de facto atomic at least on x86, the compiler may
apply re-ordering and speculation quite liberally. Basically, the old
version uses the "relaxed" memory ordering.

The new ordering always uses acquire/release ordering. This is the
strongest possible memory ordering that doesn't require additional
fence instructions on x86. (And the only stronger ordering is
"sequentially consistent", which is usually more than you need anyway.)

I would feel more comfortable if p_atomic_set/read in the old
implementation were at least using volatile loads and stores, but I
don't see a way to get there without typeof (which we cannot use here
since the code is compiled with -std=c99).

Eventually, we should really just move to something that is based on
the atomics in C11 / C++11.

Acked-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
8 years agoi965: use L3 data cache for SSBOs
Lionel Landwerlin [Mon, 26 Sep 2016 14:08:52 +0000 (15:08 +0100)]
i965: use L3 data cache for SSBOs

Anv programs the hardware to use L3 data cache if we use either SSBOs or
images in the shaders, we can program i965 the same way.

gl_shader_program has a bit of a confusing named field with
'NumAtomicBuffers'. It doesn't tell how many buffers are accessed by the
shader in an atomic way but instead the number of atomic counters
manipulated by the shader.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
8 years agomesa: Raise INVALID_ENUM in FramebufferTexture*D for unknown textargets.
Kenneth Graunke [Mon, 3 Oct 2016 23:37:26 +0000 (16:37 -0700)]
mesa: Raise INVALID_ENUM in FramebufferTexture*D for unknown textargets.

ES3-CTS.functional.negative_api.buffer.framebuffer_texture2d expects
glFramebufferTexture[123]D to raise GL_INVALID_ENUM when
supplied a completely bogus textarget parameter (i.e. 0xffffffff).

This is at odds with the spec.  GLES 3.1 says:

   "An INVALID_OPERATION error is generated if texture is not zero and
    textarget is not one of TEXTURE_2D, TEXTURE_2D_MULTISAMPLE, or one
    of the cube map face targets from table 8.21."

(and GLES 3.0 and GL 4.5 both have similar text).  However, GL has a
general guideline that says:

   "If a command that requires an enumerated value is passed a symbolic
    constant that is not one of those specified as allowable for that
    command, an INVALID_ENUM error is generated."

Apparently other vendors reconcile these two rules as follows: GL should
raise INVALID_OPERATION for actual texture target enumeration values
which are not allowed for this particular glFramebufferTexture*D call.
Any value that is not a texture target should result in GL_INVALID_ENUM.

For example, glFramebufferTexture2D with GL_TEXTURE_1D would result in
INVALID_OPERATION because it is a real texture target, but not allowed
for the 2D version of the function.  But calling it with GL_FRONT would
result in INVALID_ENUM, as that isn't even a texture target.

Fixes:
- {ES3-CTS,dEQP-GLES3}.functional.negative_api.buffer.framebuffer_texture2d
- {ES31-CTS,ES32-CTS,dEQP-GLES31}.functional.debug.negative_coverage.get_error.buffer.framebuffer_texture2d

References: https://gitlab.khronos.org/opengl/cts/merge_requests/387
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
8 years agomesa: Reorganize check_textarget().
Kenneth Graunke [Mon, 3 Oct 2016 23:37:25 +0000 (16:37 -0700)]
mesa: Reorganize check_textarget().

Having one top-level switch statement covering all known texture targets
will make the next change easier to implement.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
8 years agoaubinator: use the correct format specifier for printing ptrdiff_t.
Kenneth Graunke [Tue, 4 Oct 2016 17:01:54 +0000 (10:01 -0700)]
aubinator: use the correct format specifier for printing ptrdiff_t.

Fixes more warnings in 32-bit builds.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
8 years agoaubinator: Use less -RS instead of -r for the implicit pager.
Kenneth Graunke [Fri, 30 Sep 2016 03:43:42 +0000 (20:43 -0700)]
aubinator: Use less -RS instead of -r for the implicit pager.

From the less man page:

   "Warning: when the -r option is used, less cannot keep track of the
    actual appearance  of  the screen (since this depends  on  how the
    screen responds to each type of control character).  Thus, various
    display problems may result, such as long lines being split in the
    wrong place."

Lines which are too long to fit in the terminal would be word wrapped,
but unfortunately less would get confused about which line it was on,
and text would be drawn on top of other text.  The most noticable case
was shader assembly, which is frequently too wide for an 80 character
terminal, and thus would be drawn on top of the following state packets,
making them completely unreadable.

Using -R instead of -r fixes this problem by only allowing color escape
sequences.  (Notably, Git's implicit pager invocation uses -R.)
Unfortunately, it means our "clear to the end of the line" hack for
extending the blue bar headers won't work anymore.

Word wrapping usually isn't terribly readable, anyway, so we also add
the -S option (chop long lines) to restrict it to the terminal width.
(You can hit the left and right arrow keys to scroll sideways.)

Then, for a new blue bar hack, we can use a printf specifier to pad
the command packet names to be 80 characters long (arbitrarily), which
extends them "far enough" to look good, and doesn't require us to use
ioctls to determine the terminal width.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Sirisha Gandikota <sirisha.gandikota@intel.com>
8 years agoi965: Drop _NEW_TRANSFORM from 3DSTATE_VS atom on Gen7.
Kenneth Graunke [Tue, 4 Oct 2016 04:41:10 +0000 (21:41 -0700)]
i965: Drop _NEW_TRANSFORM from 3DSTATE_VS atom on Gen7.

The atom that uploads push constants listens to _NEW_TRANSFORM for
legacy clip plane handling.  On Sandybridge, the gen6_vs_state atom
emits 3DSTATE_CONSTANT_VS as well as 3DSTATE_VS, so it needs to listen
to the same set of conditions.

However, it looks like Gen7 doesn't need this.  The push constant atom
emits 3DSTATE_CONSTANT_VS directly, and the gen7_vs_state atom that
emits 3DSTATE_VS doesn't have a dependency on ctx->Transform.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agoi965: Fix brw_clear_cache to clean up TCS/TES shaders.
Kenneth Graunke [Fri, 23 Sep 2016 04:04:21 +0000 (21:04 -0700)]
i965: Fix brw_clear_cache to clean up TCS/TES shaders.

We need to free prog_data for TCS/TES too.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Timothy Arceri <timothy.arcero@collabora.com>
8 years agoi965: Add missing BRW_CS_PROG_DATA to CS work group surface atom.
Kenneth Graunke [Thu, 22 Sep 2016 04:43:35 +0000 (21:43 -0700)]
i965: Add missing BRW_CS_PROG_DATA to CS work group surface atom.

Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agoi965: Add missing BRW_NEW_CS_PROG_DATA to compute constant atom.
Kenneth Graunke [Thu, 22 Sep 2016 04:31:25 +0000 (21:31 -0700)]
i965: Add missing BRW_NEW_CS_PROG_DATA to compute constant atom.

CACHE_NEW_CS_PROG hasn't existed in quite a long time...the old
comment was there, but not the actual bit.

Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agoi965: Add missing BRW_NEW_FS_PROG_DATA to render target reads.
Kenneth Graunke [Thu, 22 Sep 2016 04:20:19 +0000 (21:20 -0700)]
i965: Add missing BRW_NEW_FS_PROG_DATA to render target reads.

Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agoi965: Move BRW_NEW_FRAGMENT_PROGRAM from 3DSTATE_PS to PS_EXTRA.
Kenneth Graunke [Fri, 9 Sep 2016 05:26:20 +0000 (22:26 -0700)]
i965: Move BRW_NEW_FRAGMENT_PROGRAM from 3DSTATE_PS to PS_EXTRA.

3DSTATE_PS doesn't need this.  3DSTATE_PS_EXTRA however does,
for brw_color_buffer_write_enabled().

Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agoi965: Add missing BRW_NEW_VS_PROG_DATA to 3DSTATE_CLIP.
Kenneth Graunke [Mon, 12 Sep 2016 05:50:20 +0000 (22:50 -0700)]
i965: Add missing BRW_NEW_VS_PROG_DATA to 3DSTATE_CLIP.

Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agoi965: Fix missing _NEW_TRANSFORM in Gen8+ 3DSTATE_DS atom.
Kenneth Graunke [Fri, 9 Sep 2016 03:35:39 +0000 (20:35 -0700)]
i965: Fix missing _NEW_TRANSFORM in Gen8+ 3DSTATE_DS atom.

Needed for user clip plane enables.  Broken since this code was
introduced.

Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agoi965: Enable ARB_shader_atomic_counter_ops
Ian Romanick [Thu, 30 Jun 2016 17:38:16 +0000 (10:38 -0700)]
i965: Enable ARB_shader_atomic_counter_ops

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
8 years agoi965: Refactor emission of atomic counter operations
Ian Romanick [Thu, 30 Jun 2016 16:14:37 +0000 (09:14 -0700)]
i965: Refactor emission of atomic counter operations

This will make it easier to add more operations.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
8 years agonir/intrinsics: Add more atomic_counter ops
Ian Romanick [Thu, 30 Jun 2016 01:00:22 +0000 (18:00 -0700)]
nir/intrinsics: Add more atomic_counter ops

v2: Delete some stray debug code notice by Iago.

v3: Massive rebase on new ir_function_signature::intrinsic_id mechanism.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com> [v1]
Acked-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agonir/intrinsics: Include atomic_counter_ in the names used in macro invocations
Ian Romanick [Thu, 30 Jun 2016 00:46:17 +0000 (17:46 -0700)]
nir/intrinsics: Include atomic_counter_ in the names used in macro invocations

Otherwise grepping for where atomic_counter_inc and friends are defined
is a very frustrating experience.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Acked-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agoglsl: Kill __intrinsic_atomic_sub
Ian Romanick [Thu, 7 Jul 2016 20:57:11 +0000 (13:57 -0700)]
glsl: Kill __intrinsic_atomic_sub

Just generate an __intrinsic_atomic_add with a negated parameter.

Some background on the non-obvious reasons for the the big change to
builtin_builder::call()... this is cribbed from some discussion with
Ilia on mesa-dev.

Why change builtin_builder::call() to allow taking dereferences and
create them here rather than just feeding in the ir_variables directly?
The problem is the neg_data ir_variable node would have to be in two
lists at the same time: the instruction stream and parameters.  The
ir_variable node is automatically added to the instruction stream by the
call to make_temp.  Restructuring the code so that the ir_variables
could be in parameters then move them to the instruction stream would
have been pretty terrible.

ir_call in the instruction stream has an exec_list that contains
ir_dereference_variable nodes.

The builtin_builder::call method previously took an exec_list of
ir_variables and created a list of ir_dereference_variable.  All of the
original users of that method wanted to make a function call using
exactly the set of parameters passed to the built-in function (i.e.,
call __intrinsic_atomic_add using the parameters to atomicAdd).  For
these users, the list of ir_variables already existed:  the list of
parameters in the built-in function signature.

This new caller doesn't do that.  It wants to call a function with a
parameter from the function and a value calculated in the function.  So,
I changed builtin_builder::call to take a list that could either be a
list of ir_variable or a list of ir_dereference_variable.  In the former
case it behaves just as it previously did.  In the latter case, it uses
(and removes from the input list) the ir_dereference_variable nodes
instead of creating new ones.

   text    data     bss     dec     hex filename
6036395  283160   28608 6348163  60dd83 lib64/i965_dri.so before
6036923  283160   28608 6348691  60df93 lib64/i965_dri.so after

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Acked-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agoglsl: Remove ir_function_signature::_is_intrinsic field
Ian Romanick [Thu, 1 Sep 2016 01:42:34 +0000 (18:42 -0700)]
glsl: Remove ir_function_signature::_is_intrinsic field

   text    data     bss     dec     hex filename
6036491  283160   28608 6348259  60dde3 lib64/i965_dri.so before
6036395  283160   28608 6348163  60dd83 lib64/i965_dri.so after

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Acked-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agoglsl: Add ir_function_signature::is_intrinsic() method
Ian Romanick [Thu, 1 Sep 2016 01:38:57 +0000 (18:38 -0700)]
glsl: Add ir_function_signature::is_intrinsic() method

This necessetated renaming the is_intrinsic field to _is_intrinsic.  The
next commit will remove the field.

   text    data     bss     dec     hex filename
6036507  283160   28608 6348275  60ddf3 lib64/i965_dri.so before
6036491  283160   28608 6348259  60dde3 lib64/i965_dri.so after

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Acked-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agoglsl: Use the ir_intrinsic_* enums instead of the __intrinsic_* name strings
Ian Romanick [Thu, 1 Sep 2016 01:09:27 +0000 (18:09 -0700)]
glsl: Use the ir_intrinsic_* enums instead of the __intrinsic_* name strings

   text    data     bss     dec     hex filename
6038043  283160   28608 6349811  60e3f3 lib64/i965_dri.so before
6036507  283160   28608 6348275  60ddf3 lib64/i965_dri.so after

v2: s/ir_intrinsic_atomic_sub/ir_intrinsic_atomic_counter_sub/.  Noticed
by Ilia.

v3: Silence unhandled enum in switch warnings in st_glsl_to_tgsi.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Acked-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agoglsl: Track a unique intrinsic ID with each intrinsic function
Ian Romanick [Wed, 31 Aug 2016 00:49:24 +0000 (17:49 -0700)]
glsl: Track a unique intrinsic ID with each intrinsic function

   text    data     bss     dec     hex filename
6037483  283160   28608 6349251  60e1c3 lib64/i965_dri.so before
6038043  283160   28608 6349811  60e3f3 lib64/i965_dri.so after

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Acked-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agoglsl: Don't emit ir_binop_carry during ir_binop_imul_high lowering
Ian Romanick [Mon, 3 Oct 2016 22:47:29 +0000 (15:47 -0700)]
glsl: Don't emit ir_binop_carry during ir_binop_imul_high lowering

st_glsl_to_tgsi only calls lower_instructions once (instead of in a
loop), so the ir_binop_carry generated would not get lowered.  Fixes
assertion failure

state_tracker/st_glsl_to_tgsi.cpp:2265: void glsl_to_tgsi_visitor::visit_expression(ir_expression*, st_src_reg*): Assertion `!"Invalid ir opcode in glsl_to_tgsi_visitor::visit()"' failed.

on softpipe in 16 piglit tests:

    mesa_shader_integer_functions/execution/built-in-functions/fs-imulExtended-nonuniform.shader_test
    mesa_shader_integer_functions/execution/built-in-functions/fs-imulExtended-only-msb-nonuniform.shader_test
    mesa_shader_integer_functions/execution/built-in-functions/fs-imulExtended-only-msb.shader_test
    mesa_shader_integer_functions/execution/built-in-functions/fs-imulExtended.shader_test
    mesa_shader_integer_functions/execution/built-in-functions/fs-umulExtended-nonuniform.shader_test
    mesa_shader_integer_functions/execution/built-in-functions/fs-umulExtended-only-msb-nonuniform.shader_test
    mesa_shader_integer_functions/execution/built-in-functions/fs-umulExtended-only-msb.shader_test
    mesa_shader_integer_functions/execution/built-in-functions/fs-umulExtended.shader_test
    mesa_shader_integer_functions/execution/built-in-functions/vs-imulExtended-nonuniform.shader_test
    mesa_shader_integer_functions/execution/built-in-functions/vs-imulExtended-only-msb-nonuniform.shader_test
    mesa_shader_integer_functions/execution/built-in-functions/vs-imulExtended-only-msb.shader_test
    mesa_shader_integer_functions/execution/built-in-functions/vs-imulExtended.shader_test
    mesa_shader_integer_functions/execution/built-in-functions/vs-umulExtended-nonuniform.shader_test
    mesa_shader_integer_functions/execution/built-in-functions/vs-umulExtended-only-msb-nonuniform.shader_test
    mesa_shader_integer_functions/execution/built-in-functions/vs-umulExtended-only-msb.shader_test
    mesa_shader_integer_functions/execution/built-in-functions/vs-umulExtended.shader_test

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agoi965: fix unused variable warning in brw_emit_gpgpu_walker()
Timothy Arceri [Tue, 4 Oct 2016 00:15:08 +0000 (11:15 +1100)]
i965: fix unused variable warning in brw_emit_gpgpu_walker()

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
8 years agoi965: add MAYBE_UNUSED to assert param
Timothy Arceri [Tue, 4 Oct 2016 00:15:07 +0000 (11:15 +1100)]
i965: add MAYBE_UNUSED to assert param

Fixes unused variable warning in release build.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
8 years agoi965: wrap unused function in #ifndef NDEBUG
Timothy Arceri [Tue, 4 Oct 2016 00:15:06 +0000 (11:15 +1100)]
i965: wrap unused function in #ifndef NDEBUG

This function is only ever used by an assert() this fixes an
unused function warning in release builds.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>