platform/upstream/mesa.git
7 years agosvga: Support accelerated conditional blitting
Thomas Hellstrom [Wed, 12 Apr 2017 08:38:23 +0000 (10:38 +0200)]
svga: Support accelerated conditional blitting

The blitter has functions to save and restore the conditional rendering state,
but we currently don't save the needed info.

Since also the copy_region_vgpu10 path supports conditional blitting,
we instead use the same function as the clearing routines and move
that function to svga_pipe_query.c

Note that we still haven't implemented conditional blitting with
the software fallbacks.

Fixes piglit nv_conditional_render::copyteximage

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
7 years agosvga: Use utility functions to help determine whether we can use copy_region
Thomas Hellstrom [Wed, 12 Apr 2017 07:28:49 +0000 (09:28 +0200)]
svga: Use utility functions to help determine whether we can use copy_region

It seems like the SVGA tests are in general more stringent than the utility
tests, but they also miss some blitter features like filters and window
rectangles, and if new blitter features are added in the future, it might
be possible that we forget adding tests for those.

So in addition to the SVGA tests, use the utility tests to restrict the
situations where we can use copy_region.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
7 years agosvga: Rework the blit and resource_copy_region functionality v3
Thomas Hellstrom [Tue, 11 Apr 2017 13:18:04 +0000 (15:18 +0200)]
svga: Rework the blit and resource_copy_region functionality v3

This work was initially trigged by the fact that imported surfaces may
be backed by other SVGA3D formats than the default. Therefore some fixes were
needed to avoid using the copy_region_vgpu10() functionality for incompatible
SVGA3D formats where the pipe formats were OK. This situation happens when
using dri3.

Also in some situations, for example where a R8G8_UNORM surface is backed by
an SVGA3D_NV12 format, we can't use the copy_region functionality at all and
thus need to fall back to the quad blitter also for the resource_copy_region
function. This situation doesn't happen currently, but will if we start using
video textures.

The patch makes the blit- and copy_region paths similar and the decision whether
to use a certain gpu command should now be easy to locate. Probably the
resource_copy_region path will suffer from a minor additional cpu overhead,
but on the other hand there are more cases now that we accelerate, since
we try harder before falling back to cpu copies / blits.

v2: Addressed review comments and fixed up piglit failures by sometimes
preferring cpu_copy_region() over blit().
v3: Removed a stray test statement. Updated commit message.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
7 years agoi965: Improve conditional rendering in fallback paths.
Kenneth Graunke [Thu, 2 Mar 2017 00:41:05 +0000 (16:41 -0800)]
i965: Improve conditional rendering in fallback paths.

We need to fall back in a couple of cases:
- Sandybridge (it just doesn't do this in hardware)
- Occlusion queries on Gen7-7.5 with command parser version < 2
- Transform feedback overflow queries on Gen7, or on Gen7.5 with
  command parser version < 7

In these cases, we printed a perf_debug message and fell back to
_mesa_check_conditional_render(), which stalls until the full
query result is available.  Additionally, the code to handle this
was a bit of a mess.

We can do better by using our normal conditional rendering code,
and setting a new state, BRW_PREDICATE_STATE_STALL_FOR_QUERY, when
we would have set BRW_PREDICATE_STATE_USE_BIT.  Only if that state
is set do we perf_debug and potentially stall.  This means we avoid
stalls when we have a partial query result (i.e. we know it's > 0,
but don't have the full value).  The perf_debug should trigger less
often as well.

Still, this is primarily intended as a cleanup.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
7 years agoconfigure.ac: remove manual AC_SUBST for pthread-stubs
Emil Velikov [Sun, 4 Jun 2017 23:04:02 +0000 (00:04 +0100)]
configure.ac: remove manual AC_SUBST for pthread-stubs

Unneeded, since the PKG_CHECK_MODULES macro already does the
substitution of the package Cflags/Libs.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
7 years agoconfigure.ac: add -pthread to PTHREAD_LIBS
Emil Velikov [Sun, 4 Jun 2017 23:03:59 +0000 (00:03 +0100)]
configure.ac: add -pthread to PTHREAD_LIBS

As described inline - follow what's written in the manual and what works
for all platforms that Mesa supports.

We want to untangle things leaving only -pthread, yet that has a
potential of causing regressions. Thus we'll do it as a follow-up patch.

As a nice side-effect this resolves issues, where the system lacks
libpthread.so, yet the linker does not warn about it and we and up with
unresolved symbols.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=101071
Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
7 years agomesa: stop assigning unused storage for non-bindless opaque types
Timothy Arceri [Thu, 15 Jun 2017 01:56:28 +0000 (11:56 +1000)]
mesa: stop assigning unused storage for non-bindless opaque types

The storage was once used by get_sampler_uniform_value() but that
was fixed long ago to use the uniform storage assigned by the
linker.

By not assigning storage for images/samplers the constant buffer
for gallium drivers will be reduced which could result in small
perf improvements.

V2: rebase on ARB_bindless_texture

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
7 years agoegl/android: Fix typ-o
Robert Foss [Thu, 15 Jun 2017 20:47:53 +0000 (16:47 -0400)]
egl/android: Fix typ-o

Signed-off-by: Robert Foss <robert.foss@collabora.com>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
7 years agodraw: check for line_width != 1.0f in validate_pipeline()
Brian Paul [Thu, 15 Jun 2017 17:29:38 +0000 (11:29 -0600)]
draw: check for line_width != 1.0f in validate_pipeline()

We shouldn't use the wide line stage if the line width is 1.
This check isn't strictly needed because all drivers are (now)
specifying a line wide threshold of at least 1.0 pixels, but
let's play it safe.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
7 years agosvga: clamp device line width to at least 1 to fix HWv8 line stippling
Brian Paul [Thu, 15 Jun 2017 17:31:53 +0000 (11:31 -0600)]
svga: clamp device line width to at least 1 to fix HWv8 line stippling

The line stipple fallback code for virtual HW version 8 didn't work.

With HW version 8, we were getting zero when querying the max line
widths (AA and non-AA).  This means we were setting the draw module's
wide line threshold to zero.  This caused the wide line stage to always
get enabled.  That caused the line stipple module to fall because the
wide line stage was clobbering the rasterization state with a state
object setting the line stipple pattern to 0xffff.

Now the wide_lines variable in draw's validate_pipeline() will not
be incorrectly set.

Also improve debug output.

BTW, also this fixes several other piglit tests: polygon-mode,
primitive- restart-draw-mode, and line-flat-clip-color since they
all use the draw module fallback.

See VMware bug 1895811.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
7 years agodraw: whitespace and formatting fixes
Brian Paul [Thu, 15 Jun 2017 17:40:37 +0000 (11:40 -0600)]
draw: whitespace and formatting fixes

Trivial.

7 years agoautomake: increase the MESA_GIT_SHA1 hash id length from 7 to 10 digits
Brian Paul [Thu, 15 Jun 2017 03:38:31 +0000 (21:38 -0600)]
automake: increase the MESA_GIT_SHA1 hash id length from 7 to 10 digits

The SCons build has been using 10 digits of the git hash id for the
MESA_GIT_SHA1 string in git_sha1.h for about a year now.  I bumped it
up after running into a case where a 7-digit hash ID was ambiguous.

This patch makes the same change for the autotools build.

The command "git log | grep "^commit" | cut -b 8-14 | sort | uniq -d"
shows there are currently 17 cases where 7 digits of hash id are
ambiguous on master (probably quite a few more if we'd consider other
branches).

Instead of using "git log -n 1 --oneline" use
"git rev-parse --short=10 HEAD" to get the HEAD hash id.

v2: use printf instead of sed, per Eric's suggestion.

Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
7 years agogallium: Add renderonly-based support for pl111+vc4.
Eric Anholt [Mon, 8 May 2017 22:57:21 +0000 (15:57 -0700)]
gallium: Add renderonly-based support for pl111+vc4.

This follows the model of imx (display) and etnaviv (render): pl111 is a
display-only device, so when asked to do GL for it, we see if we have a
vc4 renderer, make the vc4 screen, and have vc4 call back to pl111 to do
scanout allocations.

The difference from etnaviv is that we share the same BO between vc4 and
pl111, rather than having a vc4 bo and a pl11 bo and copies between the
two.  The only mismatch between their requirements is that vc4 requires
4-pixel (at 32bpp) stride alignment, while pl111 requires that stride
match width.  The kernel will reject any modesets to an incorrect stride,
so the 3D driver doesn't need to worry about that.

v2: Rebase on Android rework, drop unused include.
v3: Fix another Android bug, from Rob Herring's build-testing.

Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
7 years agoetnaviv: Only use renderonly_get_handle for GEM handles.
Eric Anholt [Wed, 10 May 2017 23:06:11 +0000 (16:06 -0700)]
etnaviv: Only use renderonly_get_handle for GEM handles.

Note that for requests for Prime FDs or flink names, we return handles to
the etanviv BO, not the scanout BO.  This is at least better than previous
behavior of returning GEM handles for a request for an FD or flink name.

And add an assert that renderonly_get_handle is only used for getting the
GEM handle.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
7 years agoandroid: r600/eg: add support for tracing IBs after a hang.
Mauro Rossi [Sun, 4 Jun 2017 17:11:48 +0000 (19:11 +0200)]
android: r600/eg: add support for tracing IBs after a hang.

The rules to generate egd_tables.h are added in Android makefile

Fixes: f42fb00 "r600/eg: add support for tracing IBs after a hang."
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agosvga: fix git_sha1.h include path in Android.mk (v3)
Mauro Rossi [Tue, 6 Jun 2017 21:28:33 +0000 (23:28 +0200)]
svga: fix git_sha1.h include path in Android.mk (v3)

Adds libmesa_git_sha1 static (dummy) library to generate git_sha1.h
with some polishing to header dependency on .git/HEAD and scripted rules.

The now redundant generation rules are removed from Android.gen.mk
libmesa_git_sha1 whole static depedency is added to libmesa_pipe_svga,
libmesa_dricore and libmesa_st_mesa modules

Fixes the following building error:

external/mesa/src/gallium/drivers/svga/svga_screen.c:26:10:
fatal error: 'git_sha1.h' file not found
         ^
1 error generated.

Fixes: 1ce3a27 ("svga: Add the ability to log messages to
vmware.log on the host.")
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agobin/get-fixes-pick-list.sh: better identify multiple "fixes:" tags
Andres Gomez [Sat, 13 May 2017 00:11:08 +0000 (03:11 +0300)]
bin/get-fixes-pick-list.sh: better identify multiple "fixes:" tags

We were not considering as multiple fixes lines with:
Fixes: $sha_1, Fixes: $sha_2

Now, we split the lines so we will consider them individually, as in:
Fixes: $sha_1,
Fixes: $sha_2

Additionally, we try to get the SHA from split lines so:
Fixes:
$sha_1

Will be considered as:
Fixes: $sha_1

v2:
 - Treat empty spaces earlier in fix lines (Emil)
 - Fold 2 lines into one to gather fix commit ids (Emil)

Signed-off-by: Andres Gomez <agomez@igalia.com>
Reviewed-by: Emil Velikov <emli.velikov@collabora.com>
7 years agobin/get-fixes-pick-list.sh: parse just the commit message
Andres Gomez [Sat, 13 May 2017 00:11:07 +0000 (03:11 +0300)]
bin/get-fixes-pick-list.sh: parse just the commit message

We were parsing the whole diff, although the candidates were
identified only by the commit message.

Now, we only use the commit message for parsing.

Signed-off-by: Andres Gomez <agomez@igalia.com>
Reviewed-by: Emil Velikov <emli.velikov@collabora.com>
7 years agogallium/radeon: fix initialization of new resource bindless fields
Samuel Pitoiset [Wed, 14 Jun 2017 19:11:19 +0000 (21:11 +0200)]
gallium/radeon: fix initialization of new resource bindless fields

r600_resource objects are not calloc'd.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agogbm: implement FD import with modifier
Lucas Stach [Thu, 8 Jun 2017 18:56:17 +0000 (20:56 +0200)]
gbm: implement FD import with modifier

This implements a way to import FDs with modifiers on plain GBM devices,
without the need to go through EGL. This is mostly to the benefit of
gbm_gralloc, which can keep its dependencies low.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Tested-by: Robert Foss <robert.foss@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agogbm: add API to to import FD with modifier
Lucas Stach [Thu, 8 Jun 2017 18:56:16 +0000 (20:56 +0200)]
gbm: add API to to import FD with modifier

This allows to import an FD with an explicit modifier passed through
userspace protocols.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Tested-by: Robert Foss <robert.foss@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agoi965: gen4_blorp_exec.h to the sources list
Emil Velikov [Wed, 14 Jun 2017 16:00:50 +0000 (17:00 +0100)]
i965: gen4_blorp_exec.h to the sources list

We tend to use the sources, as opposed to EXTRA_DIST to include the
headers.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Juan A. Suarez Romero <jasuarez@igalia.com>
7 years agogallium/util: Break recursion in pipe_resource_reference
Michel Dänzer [Tue, 13 Jun 2017 03:02:59 +0000 (12:02 +0900)]
gallium/util: Break recursion in pipe_resource_reference

It calling itself recursively prevented it from being inlined, resulting
in a copy being generated in every compilation unit referencing it. This
bloated the text segment of the Gallium mega-driver *_dri.so by ~4%,
and might also have impacted performance.

Fixes: ecd6fce2611e ("mesa/st: support lowering multi-planar YUV")
v2:
* Add comment above pipe_resource_next_reference [Samuel Pitoiset]
v3:
* Use loop to unreference the full chain of resources referenced via
  the next members [Timothy Arceri]
v4:
* Stop chasing ->next chain at the first sub-resource which isn't
  destroyed [Nicolai Hähnle]

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agomesa: fix 'make check' by moving bindless functions at the right place
Samuel Pitoiset [Wed, 14 Jun 2017 16:08:09 +0000 (18:08 +0200)]
mesa: fix 'make check' by moving bindless functions at the right place

Fixes: 5f249b9f05e ("mapi: add GL_ARB_bindless_texture entry points")
Reported-by: Mark Janes <mark.a.janes@intel.com>
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Tested-by: Aaron Watry <awatry@gmail.com>
Tested-by: Michel Dänzer <michel.daenzer@amd.com>
7 years agoi965/miptree: Use the new simple alloc_tiled for CCS buffers
Jason Ekstrand [Mon, 12 Jun 2017 16:44:20 +0000 (09:44 -0700)]
i965/miptree: Use the new simple alloc_tiled for CCS buffers

Reviewed-by: Plamena Manolova <plamena.manolova@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965/bufmgr: Add a new, simpler, bo_alloc_tiled
Jason Ekstrand [Mon, 12 Jun 2017 16:40:42 +0000 (09:40 -0700)]
i965/bufmgr: Add a new, simpler, bo_alloc_tiled

ISL already has all of the complexity required to figure out the correct
surface pitch and size taking tile alignment into account.  When we get
a surface out of ISL, the pitch and size are already correct and using
brw_bo_alloc_tiled_2d doesn't actually gain us anything other than extra
asserts we have to do in order to ensure that the bufmgr code and ISL
agree.  This new helper doesn't try to be smart but just allocates the
BO you ask for and sets up the tiling.

Reviewed-by: Plamena Manolova <plamena.manolova@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965/bufmgr: Rename bo_alloc_tiled to bo_alloc_tiled_2d
Jason Ekstrand [Mon, 12 Jun 2017 16:35:22 +0000 (09:35 -0700)]
i965/bufmgr: Rename bo_alloc_tiled to bo_alloc_tiled_2d

Reviewed-by: Plamena Manolova <plamena.manolova@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: Use blorp for depth/stencil clears on gen6+
Jason Ekstrand [Sun, 9 Oct 2016 05:54:00 +0000 (22:54 -0700)]
i965: Use blorp for depth/stencil clears on gen6+

Acked-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agoi965: Set step_rate = 0 for interleaved vertex buffers
Jason Ekstrand [Wed, 7 Jun 2017 00:53:26 +0000 (17:53 -0700)]
i965: Set step_rate = 0 for interleaved vertex buffers

Before, we weren't setting step rate so we got whatever old value
happened to be lying around.  This can lead to some interesting
rendering errors.  In particular, if you run the OpenGL ES CTS with
dEQP-GLES3.functional.instanced.types.mat2x4 immediately followed by one
of the dEQP-GLES3.functional.transform_feedback.* tests, the transform
feedback test gets stale instancing data from the other test and fails.
The only thing that is causing this to not be a problem today is that we
use meta for clears and meta is setting up vertex buffers via the VBO or
non-interleaved path and setting step_rate to 0 for us.  When blorp
depth/stencil clears are enabled, meta is no longer sitting between the
two tests and the stale data starts causing noticeable problems.

Cc: "17.1" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
7 years agoi965: Disable the interleaved vertex optimization when instancing
Jason Ekstrand [Wed, 7 Jun 2017 03:58:31 +0000 (20:58 -0700)]
i965: Disable the interleaved vertex optimization when instancing

Instance divisor is a property of the vertex buffer and not the vertex
element so if we ever see anything other than 0, bail.

Cc: "17.1" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
7 years agointel/blorp: Work around Sandy Bridge occlusion query issue
Jason Ekstrand [Thu, 8 Jun 2017 16:36:15 +0000 (09:36 -0700)]
intel/blorp: Work around Sandy Bridge occlusion query issue

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
7 years agoi965/blorp: Set no_depth_or_stencil correctly
Jason Ekstrand [Sat, 3 Jun 2017 21:48:15 +0000 (14:48 -0700)]
i965/blorp: Set no_depth_or_stencil correctly

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
7 years agoi965: Remove some unneeded fields from brw_context
Jason Ekstrand [Sat, 3 Jun 2017 22:51:29 +0000 (15:51 -0700)]
i965: Remove some unneeded fields from brw_context

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
7 years agoi965: Remove some of the remnants of meta
Jason Ekstrand [Sat, 3 Jun 2017 22:20:32 +0000 (15:20 -0700)]
i965: Remove some of the remnants of meta

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
7 years agointel/isl: Properly set SeparateStencilBufferEnable on gen5-6
Jason Ekstrand [Fri, 2 Jun 2017 17:36:04 +0000 (10:36 -0700)]
intel/isl: Properly set SeparateStencilBufferEnable on gen5-6

On gen5-6, SeparateStencilBufferEnable and HierarchicalDepthBufferEnable
come hand in hand and we have to set either both or neither.

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
7 years agoi965/miptree: Choose the stencil layout in miptree_create_layout
Jason Ekstrand [Fri, 2 Jun 2017 17:05:21 +0000 (10:05 -0700)]
i965/miptree: Choose the stencil layout in miptree_create_layout

This ensures that we get the correct layout for all stencil buffers, not
just those which are created as separate stencil for a depth buffer.

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
7 years agomesa: Add a BUFFER_BITS mask for depth+stencil
Jason Ekstrand [Wed, 12 Oct 2016 21:15:41 +0000 (14:15 -0700)]
mesa: Add a BUFFER_BITS mask for depth+stencil

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
7 years agoi965/blorp: Set aux_usage to NONE for miplevels without HiZ
Jason Ekstrand [Mon, 10 Oct 2016 18:18:06 +0000 (11:18 -0700)]
i965/blorp: Set aux_usage to NONE for miplevels without HiZ

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
7 years agoradeon/winsys: Limit max allocation size to 70% of VRAM
Aaron Watry [Fri, 9 Jun 2017 17:57:42 +0000 (12:57 -0500)]
radeon/winsys: Limit max allocation size to 70% of VRAM

The CL CTS queries the max allocation size, and then attempts to
allocate buffers of that size. If not enough contiguous RAM/VRAM is
available, this causes errors in the radeon kernel module due to
inability to allocate the required memory.

It's a bit of a hack, but experimentally on my system, I can use ~3/4
of the card's VRAM for a single global/constant buffer allocation given
current GUI/compositor use.

For a 1GB Pitcairn (HD7850) this gets me from the reported clinfo values of:
Global memory size                              2143076352 (1.996GiB)
Max memory allocation                           1500153446 (1.397GiB)
Max constant buffer size                        1500153446 (1.397GiB)

To:
Global memory size                              2143076352 (1.996GiB)
Max memory allocation                           751619276 (716MiB)
Max constant buffer size                        751619276 (716MiB)

Fixes: OpenCL CTS test/conformance/api/min_max_mem_alloc_size,
       OpenCL CTS test/conformance/api/min_max_constant_buffer_size

Signed-off-by: Aaron Watry <awatry@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoi965: Use a line end cap width of 0.5 unless smooth lines enabled.
Kenneth Graunke [Wed, 10 May 2017 09:45:53 +0000 (02:45 -0700)]
i965: Use a line end cap width of 0.5 unless smooth lines enabled.

This updates the Gen4-5 code to use a line end cap width of 0.5
for non-smooth lines, and 1.0 for smooth lines - which is what we
do on Gen6+.

Reviewed-by: Rafael Antognolli <rafael.antognolli@intel.com>
7 years agoi965: Use brw_get_line_width() in Gen4-5 SF_STATE code.
Kenneth Graunke [Wed, 10 May 2017 09:41:43 +0000 (02:41 -0700)]
i965: Use brw_get_line_width() in Gen4-5 SF_STATE code.

This unifies the Gen4-5 and Gen6+ line width calculations.

I believe it also fixes a bug - we weren't rounding the line width
to the nearest integer.  The GL 4.5 (and GL 2.1) specs "Wide Lines"
section says:

"The actual width of non-antialiased lines is determined by rounding
 the supplied width to the nearest integer, then clamping it to the
 implementation-dependent maximum non-antialiased line width."

We don't need to care about _NEW_MULTISAMPLE here because multisampling
doesn't exist on Gen4-5, so the state shouldn't change.

Reviewed-by: Rafael Antognolli <rafael.antognolli@intel.com>
7 years agogenxml: Fix Gen4-5 SF_STATE "Line Width" fixed point type.
Kenneth Graunke [Wed, 10 May 2017 09:40:47 +0000 (02:40 -0700)]
genxml: Fix Gen4-5 SF_STATE "Line Width" fixed point type.

It's a U3.1.  It became a U3.7 on Sandybridge.

Reviewed-by: Rafael Antognolli <rafael.antognolli@intel.com>
7 years agoi965: Stop using BRW_RASTRULE_LOWER_RIGHT on Gen4-5.
Kenneth Graunke [Wed, 10 May 2017 09:25:23 +0000 (02:25 -0700)]
i965: Stop using BRW_RASTRULE_LOWER_RIGHT on Gen4-5.

This effectively reverts Robert Ellison's 2009 commit
cc8afbd3862fedfe42e51c3774960d1c7078ec53.

I'm not seeing any GL spec text indicating that UPPER won't work.
On Gen6+, this bit moved to 3DSTATE_WM as a single bit, controlling
UPPER_LEFT vs. UPPER_RIGHT.  There is no way to request LOWER_RIGHT,
so UPPER_RIGHT is the best you can do.

In the G45 docs, it's marked as "Reserved" as well, but we just
decided to use it anyway.

This patch unifies the behavior between Gen4-5 and Gen6+.

Note that this is separate from point sprite texcoord behavior.

Reviewed-by: Rafael Antognolli <rafael.antognolli@intel.com>
7 years agoi965: When gl_PointSize is unwritten, default to 1.0 on Gen4-5.
Kenneth Graunke [Wed, 10 May 2017 09:07:46 +0000 (02:07 -0700)]
i965: When gl_PointSize is unwritten, default to 1.0 on Gen4-5.

Modern GL specifications say that the point size should be 1.0 when
gl_PointSize is unwritten and the last enabled stage is a geometry
or tessellation shader.  If it's a vertex shader, though, both the
GL specs and ES 3.0 spec say that it's undefined - so since Gen4-5
only support vertex shaders, there's no actual requirement to do this.

Since there is a cost associated (an extra dirty bit, which may cause
SF_STATE to be emitted more often), it may not be a good idea.

The real benefit is that it makes all generations behave identically.
And that seems somewhat nice...

Reviewed-by: Rafael Antognolli <rafael.antognolli@intel.com>
7 years agoi965: Make Gen4-5 SF_STATE use the point size calculations from Gen6+.
Kenneth Graunke [Wed, 10 May 2017 07:57:05 +0000 (00:57 -0700)]
i965: Make Gen4-5 SF_STATE use the point size calculations from Gen6+.

Apparently, Nanhai made the Gen4-5 point size calculations round to the
nearest integer in commit 8d5231a3582e4f2769ac0685cf0174e09750700e,
"according to spec".  When Eric first ported the driver to Sandybridge,
he did not implement this rounding.

In the GL 2.1 and 3.0 specs "Basic Point Rasterization" section, it does
say "If antialiasing and point sprites are disabled, the actual width is
determined by rounding the supplied width to the nearest integer, then
clamping it to the implementation-dependent maximum non-antialised point
width."

In contrast, GL 3.1 and later do not appear to contain this rounding.

It might be reasonable to round, given that we only implement GL 2.1.
Of course, if we were to do that, we should actually implement the AA
vs. non-AA distinction.  Brian added an XXX comment reminding us to fix
this 10 years ago, but it never happened.

I think a better plan is to follow the newer, unrounded behavior.  This
is what we do on Gen6+ and it passes all the relevant conformance tests.

Reviewed-by: Rafael Antognolli <rafael.antognolli@intel.com>
7 years agoi965: Do an end-of-pipe sync after flushes
Jason Ekstrand [Tue, 13 Jun 2017 17:31:41 +0000 (10:31 -0700)]
i965: Do an end-of-pipe sync after flushes

According to the docs, a simple CS stall is insufficient to ensure that
the memory from the flush is visible and an end-of-pipe sync is needed.

Cc: "17.1" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965/blorp: Do an end-of-pipe sync around CCS ops
Jason Ekstrand [Tue, 13 Jun 2017 16:29:42 +0000 (09:29 -0700)]
i965/blorp: Do an end-of-pipe sync around CCS ops

Cc: "17.1" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: Do an end-of-pipe sync prior to STATE_BASE_ADDRESS
Jason Ekstrand [Tue, 13 Jun 2017 17:19:56 +0000 (10:19 -0700)]
i965: Do an end-of-pipe sync prior to STATE_BASE_ADDRESS

Cc: "17.1" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: Add an end-of-pipe sync helper
Topi Pohjolainen [Fri, 20 Jan 2017 11:17:39 +0000 (13:17 +0200)]
i965: Add an end-of-pipe sync helper

v2 (Jason Ekstrand):
 - Take a flags parameter to control the flushes
 - Refactoring

Cc: "17.1" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: Unify the two emit_pipe_control functions
Jason Ekstrand [Tue, 13 Jun 2017 16:59:18 +0000 (09:59 -0700)]
i965: Unify the two emit_pipe_control functions

These two functions contain almost identical logic except for one SNB
workaround required for render target cache flushes.  They may as well
call into the same code so we only have to handle the work-arounds in
one place.

Cc: "17.1" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: Take a uint64_t immediate in emit_pipe_control_write
Jason Ekstrand [Tue, 13 Jun 2017 16:56:31 +0000 (09:56 -0700)]
i965: Take a uint64_t immediate in emit_pipe_control_write

It's a 64-bit value.  Splitting it up just makes the function arguments
awkward.

Cc: "17.1" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: Flush around state base address
Jason Ekstrand [Thu, 8 Jun 2017 04:39:52 +0000 (21:39 -0700)]
i965: Flush around state base address

Cc: "17.1" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: Print "force dual color blending" in FS recompile debug output.
Kenneth Graunke [Wed, 14 Jun 2017 08:52:04 +0000 (01:52 -0700)]
i965: Print "force dual color blending" in FS recompile debug output.

I forgot to add this when introducing the new key field.  It doesn't
happen often - just with the Unigine workarounds.  But we may as well
have it, so we get an accurate picture of why recompiles happen.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
7 years agoFix khrplatform.h not installed if EGL is disabled.
Eric Le Bihan [Mon, 12 Jun 2017 11:00:07 +0000 (12:00 +0100)]
Fix khrplatform.h not installed if EGL is disabled.

KHR/khrplatform.h is required by the EGL, GLES and VG headers, but is
only installed if Mesa3d is compiled with EGL support.

This patch installs this header file unconditionally.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=77240
Signed-off-by: Eric Le Bihan <eric.le.bihan.dev@free.fr>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoi915: Fix wpos_tex vs. -1 comparison
Ville Syrjälä [Mon, 5 Jun 2017 11:01:58 +0000 (14:01 +0300)]
i915: Fix wpos_tex vs. -1 comparison

wpos_tex used to be a GLuint so assigning -1 to it and
later comparing with -1 worked correctly, but commit
c349031c27b7 ("i915: Fix texcoord vs. varying collision in
fragment programs") changed wpos_tex to uint8_t and hence
broke the comparison. To fix this define a more explicit
invalid value for wpos_tex.

gcc warns us:
i915_fragprog.c:1255:57: warning: comparison is always true due to limited range of data type [-Wtype-limits]
    if (inputsRead & VARYING_BITS_TEX_ANY || p->wpos_tex != -1) {
                                                         ^

And clang says:
i915_fragprog.c:1255:57: warning: comparison of constant -1 with expression of type 'uint8_t' (aka 'unsigned char') is always true [-Wtautological-constant-out-of-range-compare]
   if (inputsRead & VARYING_BITS_TEX_ANY || p->wpos_tex != -1) {
                                            ~~~~~~~~~~~ ^  ~~

Cc: Chih-Wei Huang <cwhuang@android-x86.org>
Cc: Eric Anholt <eric@anholt.net>
Cc: Ian Romanick <ian.d.romanick@intel.com>
Cc: mesa-stable@lists.freedesktop.org
Fixes: c349031c27b7 ("i915: Fix texcoord vs. varying collision in fragment programs")
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agotgsi/scan: add missing 'static' to tgsi_is_bindless_image_file()
Samuel Pitoiset [Wed, 14 Jun 2017 09:37:17 +0000 (11:37 +0200)]
tgsi/scan: add missing 'static' to tgsi_is_bindless_image_file()

This should fix compilation errors in some situations.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=101418
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoconfigure.ac: Reduce zlib requirement from 1.2.8 to 1.2.3.
Chuck Atkins [Thu, 8 Jun 2017 17:11:32 +0000 (13:11 -0400)]
configure.ac: Reduce zlib requirement from 1.2.8 to 1.2.3.

Testing with zlib versions 1.2.{3,4,5,6,7,8} showed no difference in
functionality, correctness, or zlib API usage and 1.2.3 is the oldest
version available in still actively deployed production Linux
distributions (RHEL/CentOS 6 and SuSE 11).

Build 17.1.1 against the system supplied zlib-devel packages for 1.2.3
in EL6 and 1.2.7 on EL7. I then swapped out the zlib version at runtime
via LD_LIBRARY_PATH with ones build from the release tarballs from
zlib.net

Testwise - I ran the piglit shader profile with --quick addded to the
tests since I figured that would exercise the shader cache, which would
in turn use zlib.

Signed-off-by: Chuck Atkins <chuck.atkins@kitware.com>
Cc: 17.1 <mesa-stable@lists.freedesktop.org>
Cc: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
[Emil Velikov: add hunk about version/piglit testing]
Acked-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoradeonsi: enable ARB_bindless_texture
Samuel Pitoiset [Mon, 27 Feb 2017 12:15:38 +0000 (13:15 +0100)]
radeonsi: enable ARB_bindless_texture

This has only been tested on RX480.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoradeonsi: add support for loading bindless images
Samuel Pitoiset [Thu, 30 Mar 2017 14:55:58 +0000 (16:55 +0200)]
radeonsi: add support for loading bindless images

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoradeonsi: add support for loading bindless samplers
Samuel Pitoiset [Thu, 30 Mar 2017 15:34:49 +0000 (17:34 +0200)]
radeonsi: add support for loading bindless samplers

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoradeonsi: invalidate buffers which are made resident if needed
Samuel Pitoiset [Thu, 18 May 2017 22:04:26 +0000 (00:04 +0200)]
radeonsi: invalidate buffers which are made resident if needed

When a buffer becomes resident, check if it has been invalidated,
if so update the descriptor and the dirty flag.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoradeonsi: upload new descriptors when resident buffers are invalidated
Samuel Pitoiset [Thu, 18 May 2017 21:51:26 +0000 (23:51 +0200)]
radeonsi: upload new descriptors when resident buffers are invalidated

When texture buffers are invalidated the addr in the resident
descriptor has to be updated but we can't create a new descriptor
because the resident handle has to be the same.

Instead, use the WRITE_DATA packet which allows to update memory
directly but graphics/compute have to be idle in case the GPU is
reading the descriptor.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoradeonsi: only decompress resident textures/images when used
Samuel Pitoiset [Tue, 16 May 2017 20:31:30 +0000 (22:31 +0200)]
radeonsi: only decompress resident textures/images when used

When the current bound shaders don't use any bindless textures
or images, it's useless to decompress the resident resources.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoradeonsi: track use of bindless samplers/images from tgsi_shader_info
Samuel Pitoiset [Tue, 16 May 2017 10:25:28 +0000 (12:25 +0200)]
radeonsi: track use of bindless samplers/images from tgsi_shader_info

This adds some new helper functions to know if the current draw
call (or dispatch compute) is using bindless samplers/images,
based on TGSI analysis.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoradeonsi: decompress resident textures/images before graphics/compute
Samuel Pitoiset [Mon, 15 May 2017 21:50:32 +0000 (23:50 +0200)]
radeonsi: decompress resident textures/images before graphics/compute

Similar to the existing decompression code path except that it
loops over the list of resident textures/images.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoradeonsi: decompress DCC for resident textures/images
Samuel Pitoiset [Mon, 15 May 2017 21:48:08 +0000 (23:48 +0200)]
radeonsi: decompress DCC for resident textures/images

Analogous to bound textures/images. We should also update the
resident descriptors and disable COMPRESSION_EN for avoiding
useless DCC fetches, but I postpone this optimization for a
separate series.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoradeonsi: only add descriptors in presence of resident handles
Samuel Pitoiset [Thu, 18 May 2017 20:37:25 +0000 (22:37 +0200)]
radeonsi: only add descriptors in presence of resident handles

This won't help much except for applications that use a ton
of resident handles. Though, this will reduce the winsys
overhead a little bit.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoradeonsi: add all resident buffers to the current CS
Samuel Pitoiset [Mon, 15 May 2017 22:55:14 +0000 (00:55 +0200)]
radeonsi: add all resident buffers to the current CS

Resident buffers have to be added to every new command stream.
Though, this could be slightly improved when current shaders
don't use any bindless textures/images but usually applications
tend to use bindless for almost every draw call, and the winsys
thread might help when buffers are added early.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoradeonsi: implement ARB_bindless_texture
Samuel Pitoiset [Tue, 16 May 2017 08:49:20 +0000 (10:49 +0200)]
radeonsi: implement ARB_bindless_texture

This implements the Gallium interface. Decompression of resident
textures/images will follow in the next patches.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoradeonsi: add a slab allocator for bindless descriptors
Samuel Pitoiset [Tue, 16 May 2017 08:11:54 +0000 (10:11 +0200)]
radeonsi: add a slab allocator for bindless descriptors

For each texture/image handles, we need to allocate a new
buffer for the bindless descriptor. But when the number of
buffers added to the current CS becomes high, the overhead
in the winsys (and in the kernel) is important.

To reduce this bottleneck, the idea is to suballocate the
bindless descriptors using a slab similar to the one used
in the winsys.

Currently, a buffer can hold 1024 bindless descriptors but
this limit is arbitrary and could be changed in the future
for some reasons. Once a slab is allocated the "base" buffer
is added to a per-context list.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoradeonsi: add si_set_shader_image_desc() helper
Samuel Pitoiset [Mon, 15 May 2017 23:07:09 +0000 (01:07 +0200)]
radeonsi: add si_set_shader_image_desc() helper

To share some common code between bound and bindless images.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoradeonsi: add si_set_sampler_view_desc() helper
Samuel Pitoiset [Mon, 15 May 2017 23:53:51 +0000 (01:53 +0200)]
radeonsi: add si_set_sampler_view_desc() helper

To share some common code between bound and bindless textures.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoradeonsi: add si_init_descriptor_list() helper
Samuel Pitoiset [Fri, 31 Mar 2017 14:09:24 +0000 (16:09 +0200)]
radeonsi: add si_init_descriptor_list() helper

This will be used in order to initialize resident descriptors
for bindless textures/images.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agost/mesa: enable ARB_bindless_texture
Samuel Pitoiset [Fri, 31 Mar 2017 17:28:00 +0000 (19:28 +0200)]
st/mesa: enable ARB_bindless_texture

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agost/mesa: disable per-context seamless cubemap when using texture handles
Samuel Pitoiset [Fri, 19 May 2017 10:47:16 +0000 (12:47 +0200)]
st/mesa: disable per-context seamless cubemap when using texture handles

The ARB_bindless_texture spec say:

   "If ARB_seamless_cubemap (or OpenGL 4.0, which includes it) is
    supported, the per-context seamless cubemap enable is ignored
    and treated as disabled when using texture handles."

   "If AMD_seamless_cubemap_per_texture is supported, the seamless
    cube map texture parameter of the underlying texture does apply
    when texture handles are used."

The per-context seamless cubemap flag should only be enabled for
bound textures/samplers.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agost/mesa: make bindless samplers/images bound to units resident
Samuel Pitoiset [Mon, 15 May 2017 12:15:40 +0000 (14:15 +0200)]
st/mesa: make bindless samplers/images bound to units resident

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agost/mesa: add infrastructure for storing bound texture/image handles
Samuel Pitoiset [Fri, 12 May 2017 12:15:29 +0000 (14:15 +0200)]
st/mesa: add infrastructure for storing bound texture/image handles

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agost/mesa: add st_create_{texture,image}_handle_from_unit() helper
Samuel Pitoiset [Tue, 9 May 2017 12:32:06 +0000 (14:32 +0200)]
st/mesa: add st_create_{texture,image}_handle_from_unit() helper

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agost/mesa: add st_convert_image_from_unit() helper
Samuel Pitoiset [Fri, 12 May 2017 09:53:51 +0000 (11:53 +0200)]
st/mesa: add st_convert_image_from_unit() helper

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agost/mesa: make convert_sampler_from_unit() non-static
Samuel Pitoiset [Tue, 9 May 2017 12:07:24 +0000 (14:07 +0200)]
st/mesa: make convert_sampler_from_unit() non-static

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agost/mesa: make update_single_texture() non-static
Samuel Pitoiset [Tue, 9 May 2017 11:55:00 +0000 (13:55 +0200)]
st/mesa: make update_single_texture() non-static

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agost/mesa: implement ARB_bindless_texture
Samuel Pitoiset [Fri, 31 Mar 2017 17:27:41 +0000 (19:27 +0200)]
st/mesa: implement ARB_bindless_texture

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agotgsi/scan: record bindless samplers/images usage
Samuel Pitoiset [Thu, 13 Apr 2017 22:04:05 +0000 (00:04 +0200)]
tgsi/scan: record bindless samplers/images usage

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agost/glsl_to_tgsi: teach rename_temp_registers() about bindless samplers
Samuel Pitoiset [Fri, 5 May 2017 08:31:27 +0000 (10:31 +0200)]
st/glsl_to_tgsi: teach rename_temp_registers() about bindless samplers

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agost/glsl_to_tgsi: teach the DCE pass about bindless samplers/images
Samuel Pitoiset [Tue, 28 Mar 2017 23:22:47 +0000 (01:22 +0200)]
st/glsl_to_tgsi: teach the DCE pass about bindless samplers/images

When a texture (or an image) instruction uses a bindless sampler
(respectively a bindless image), make sure the DCE pass won't
remove code when the resource is a temporary variable.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agost/glsl_to_tgsi: add support for bindless pack/unpack operations
Samuel Pitoiset [Thu, 13 Apr 2017 09:35:03 +0000 (11:35 +0200)]
st/glsl_to_tgsi: add support for bindless pack/unpack operations

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agost/glsl_to_tgsi: add support for bindless images
Samuel Pitoiset [Thu, 13 Apr 2017 09:34:47 +0000 (11:34 +0200)]
st/glsl_to_tgsi: add support for bindless images

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agost/glsl_to_tgsi: add support for bindless samplers
Samuel Pitoiset [Wed, 19 Apr 2017 13:57:56 +0000 (15:57 +0200)]
st/glsl_to_tgsi: add support for bindless samplers

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agotgsi/ureg: accept TGSI_FILE_{CONSTANT,INPUT} for dst registers
Samuel Pitoiset [Thu, 30 Mar 2017 00:01:59 +0000 (02:01 +0200)]
tgsi/ureg: accept TGSI_FILE_{CONSTANT,INPUT} for dst registers

For example, TGSI_OPCODE_STORE for bindless images might use
a constant buffer or a shader input.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agotc: add ARB_bindless_texture support
Samuel Pitoiset [Tue, 16 May 2017 13:00:35 +0000 (15:00 +0200)]
tc: add ARB_bindless_texture support

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agotrace: add ARB_bindless_texture support
Samuel Pitoiset [Thu, 13 Apr 2017 22:54:17 +0000 (00:54 +0200)]
trace: add ARB_bindless_texture support

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoddebug: add ARB_bindless_texture support
Samuel Pitoiset [Fri, 31 Mar 2017 14:32:46 +0000 (16:32 +0200)]
ddebug: add ARB_bindless_texture support

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agogallium: add ARB_bindless_texture interface
Samuel Pitoiset [Tue, 28 Mar 2017 23:34:05 +0000 (01:34 +0200)]
gallium: add ARB_bindless_texture interface

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agogallium: add PIPE_CAP_BINDLESS_TEXTURE
Samuel Pitoiset [Thu, 16 Feb 2017 12:43:16 +0000 (13:43 +0100)]
gallium: add PIPE_CAP_BINDLESS_TEXTURE

Whether bindless texture operations are supported by the
underlying driver.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agomesa: fix setting uniform variables for bindless samplers/images
Samuel Pitoiset [Mon, 29 May 2017 20:47:24 +0000 (22:47 +0200)]
mesa: fix setting uniform variables for bindless samplers/images

This fixes a 64-bit vs 32-bit mismatch when setting an array
of bindless samplers. Also, we need to unconditionally set
size_mul to 2 when the underlying uniform is bindless.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agomesa: handle bindless uniforms bound to texture/image units
Samuel Pitoiset [Thu, 11 May 2017 16:42:22 +0000 (18:42 +0200)]
mesa: handle bindless uniforms bound to texture/image units

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agomesa: associate uniform storage to bindless samplers/images
Samuel Pitoiset [Thu, 11 May 2017 16:23:34 +0000 (18:23 +0200)]
mesa: associate uniform storage to bindless samplers/images

When a bindless sampler/image is bound to a texture/image unit,
we have to overwrite the constant value by the resident handle
directly in the constant buffer before the next draw.

One solution is to keep track of a pointer to the data.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agomesa: pass gl_program to _mesa_associate_uniform_storage()
Samuel Pitoiset [Thu, 11 May 2017 09:54:09 +0000 (11:54 +0200)]
mesa: pass gl_program to _mesa_associate_uniform_storage()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agomesa: update textures for bindless samplers bound to texture units
Samuel Pitoiset [Thu, 11 May 2017 15:29:53 +0000 (17:29 +0200)]
mesa: update textures for bindless samplers bound to texture units

This is analogous to the existing SamplerUnits and SamplerTargets,
but it loops over bindless samplers bound to texture units.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agomesa: add update_single_program_texture_state() helper
Samuel Pitoiset [Wed, 10 May 2017 12:15:33 +0000 (14:15 +0200)]
mesa: add update_single_program_texture_state() helper

This will also be used for looping over bindless samplers bound
to texture units.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>