mesa.git
7 years agovirgl: remove unused draw include
Emil Velikov [Thu, 27 Apr 2017 15:25:04 +0000 (16:25 +0100)]
virgl: remove unused draw include

Driver does not use the gallium draw module.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Acked-by: Dave Airlie <airlied@redhat.com>
7 years agoradeon: automake: remove unneeded elf Cflags/Libs
Emil Velikov [Thu, 4 May 2017 15:17:28 +0000 (16:17 +0100)]
radeon: automake: remove unneeded elf Cflags/Libs

No longer required as of commit d90bf4ef3e1 ("radeon: remove unused
radeon_elf_util.{c,h}")

v2: Add the required libelf link in src/amd/Makefile.common.am

Fixes: d90bf4ef3e1 ("radeon: remove unused radeon_elf_util.{c,h}")
Cc: Timothy Arceri <tarceri@itsqueeze.com>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com> (v1)
7 years agoanv: document that anv_gem_mmap returns MAP_FAILED on error
Emil Velikov [Thu, 4 May 2017 14:54:04 +0000 (15:54 +0100)]
anv: document that anv_gem_mmap returns MAP_FAILED on error

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
7 years agoegl: simplify the Android logger
Emil Velikov [Mon, 8 May 2017 14:38:11 +0000 (15:38 +0100)]
egl: simplify the Android logger

Drop the unsupported pre-JellyBean macros and use a simple egl2android
mapping. With this we loose the explicit abort() provided by LOG_FATAL,
although Mesa already already calls exit(1) in case of a fatal errors.

Suggested-by: Rob Herring <robh@kernel.org>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Rob Herring <robh@kernel.org>
7 years agoAndroid: Drop linking libgcc
Rob Herring [Wed, 3 May 2017 19:35:26 +0000 (14:35 -0500)]
Android: Drop linking libgcc

Including libgcc breaks on Android O (master). This doesn't appear to be
needed any more as both Android M and N have also been built w/o libgcc.

Signed-off-by: Rob Herring <robh@kernel.org>
Reviewed-by: Chih-Wei Huang <cwhuang@linux.org.tw>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoAndroid: Add LLVM support for Android O
Rob Herring [Wed, 3 May 2017 19:35:25 +0000 (14:35 -0500)]
Android: Add LLVM support for Android O

Android O moves to LLVM 3.9 and also has some differences in header
dependencies as LLVM has moved to blueprint files. It seems libLLVMCore
was only needed for header dependencies, so we can drop that for O.

Signed-off-by: Rob Herring <robh@kernel.org>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoAndroid: rework LLVM build support
Rob Herring [Wed, 3 May 2017 19:35:24 +0000 (14:35 -0500)]
Android: rework LLVM build support

Currently, building with "mmma external/mesa3d" which builds all targets
and dependencies is broken for targets that require LLVM. This is due to
the build settings depending on MESA_ENABLE_LLVM. Instead of using a
conditional in the global Android.common.mk, make all the components that
need LLVM explicitly include the necessary build settings.

GALLIVM_CPP_SOURCES doesn't exist anymore, so remove that as well.

Signed-off-by: Rob Herring <robh@kernel.org>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoAndroid: rework libelf dependencies
Rob Herring [Wed, 3 May 2017 19:35:23 +0000 (14:35 -0500)]
Android: rework libelf dependencies

Add libelf as a library dependency rather than explicitly listing its
include paths. This should work for Android M and later which have the
necessary exported directories in libelf.

Signed-off-by: Rob Herring <robh@kernel.org>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoAndroid: drop LLVM support on Lollipop
Rob Herring [Wed, 3 May 2017 19:35:22 +0000 (14:35 -0500)]
Android: drop LLVM support on Lollipop

Mesa no longer supports LLVM 3.5 for any targets we support.
Android-x86 adds support for llvmpipe which could work, but android-x86
for L is using mesa 11.0 anyway.

Dropping this support enables clean-up of libelf dependencies.

Signed-off-by: Rob Herring <robh@kernel.org>
Reviewed-by: Chih-Wei Huang <cwhuang@linux.org.tw>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoAndroid: Add driver "all" option to enable all drivers
Rob Herring [Wed, 3 May 2017 19:35:21 +0000 (14:35 -0500)]
Android: Add driver "all" option to enable all drivers

Add a driver string "all" so that if BOARD_GPU_DRIVERS is set to "all",
all the drivers are enabled in the build. This makes build testing all
drivers easier to maintain.

Signed-off-by: Rob Herring <robh@kernel.org>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoAndroid: push driver build details to driver makefiles
Rob Herring [Wed, 3 May 2017 19:35:20 +0000 (14:35 -0500)]
Android: push driver build details to driver makefiles

src/gallium/targets/dri/Android.mk contains lots of conditional for
individual drivers. Let's move these details into the individual driver
makefiles.

In the process, align the make driver conditionals with automake
(i.e. HAVE_GALLIUM_*).

Signed-off-by: Rob Herring <robh@kernel.org>
[Emil Velikov: add the radeon winsys for radeonsi]
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoAndroid: remove needless conditional including of child makefiles
Rob Herring [Wed, 3 May 2017 19:35:19 +0000 (14:35 -0500)]
Android: remove needless conditional including of child makefiles

It is not necessary to filter driver and winsys directories based on the
list of enabled drivers. Selecting the included driver libraries or not is
sufficient to control what is built.

Signed-off-by: Rob Herring <robh@kernel.org>
Reviewed-by: Chih-Wei Huang <cwhuang@linux.org.tw>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoAndroid: Fix swrast only build
Rob Herring [Wed, 3 May 2017 19:35:18 +0000 (14:35 -0500)]
Android: Fix swrast only build

A build of only swrast is broken as the Android EGL now depends on
libdrm as does GBM. While we could make EGL conditionally depend on
libdrm, we probably want to enable kms_dri winsys as well and that will
need libdrm enabled. So just always enable libdrm and simplify the
Android makefiles a bit.

Signed-off-by: Rob Herring <robh@kernel.org>
Reviewed-by: Chih-Wei Huang <cwhuang@linux.org.tw>
[Emil Velikov: drop related inline comment]
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoAndroid: amd/common: fix dependency on libmesa_nir
Rob Herring [Wed, 3 May 2017 19:35:17 +0000 (14:35 -0500)]
Android: amd/common: fix dependency on libmesa_nir

Building libmesa_amd_common fails with:

external/mesa/src/amd/common/ac_shader_info.c:23:10: fatal error: 'nir/nir.h' file not found
         ^

external/mesa/src/compiler/nir/nir.h:48:10: fatal error: 'nir_opcodes.h' file not found
         ^

libmesa_amd_common now depends on libmesa_nir, so add it as a dependency
and export the necessary directories.

Fixes: 224cf29 "radv/ac: add initial pre-pass for shader info gathering"
Signed-off-by: Rob Herring <robh@kernel.org>
Reviewed-by: Chih-Wei Huang <cwhuang@linux.org.tw>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoAndroid: amd: use exported include dirs instead of explicit includes
Rob Herring [Wed, 3 May 2017 19:35:16 +0000 (14:35 -0500)]
Android: amd: use exported include dirs instead of explicit includes

Add exported include paths rather than explicitly adding the includes
in each user of the common AMD libs.

Signed-off-by: Rob Herring <robh@kernel.org>
Reviewed-by: Chih-Wei Huang <cwhuang@linux.org.tw>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoAndroid: remove remaining explicit libcxx includes
Rob Herring [Wed, 3 May 2017 19:35:15 +0000 (14:35 -0500)]
Android: remove remaining explicit libcxx includes

Explicitly including libcxx includes is not necessary at least on
Android M and later. It appears that libc++ was made the default in
commit "Make libc++ the default STL." in Android build system post L.
However, if L support is still needed, using "LOCAL_CXX_STL=libc++" is
the preferred way.

Signed-off-by: Rob Herring <robh@kernel.org>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoAndroid: define required __STDC* macros as cflags
Mauro Rossi [Wed, 3 May 2017 19:35:14 +0000 (14:35 -0500)]
Android: define required __STDC* macros as cflags

Necessary to fix the following radeonsi building errors:

In file included from external/mesa/src/gallium/drivers/radeonsi/si_blit.c:24:
In file included from external/mesa/src/gallium/drivers/radeonsi/si_pipe.h:29:
In file included from external/mesa/src/gallium/drivers/radeonsi/si_shader.h:71:
In file included from external/llvm/include/llvm-c/Core.h:18:
In file included from external/llvm/include/llvm-c/ErrorHandling.h:17:
In file included from external/llvm/include/llvm-c/Types.h:17:
external/llvm/include/llvm/Support/DataTypes.h:49:3: error: "Must #define __STDC_LIMIT_MACROS before #including Support/DataTypes.h"
  ^
external/llvm/include/llvm/Support/DataTypes.h:53:3: error: "Must #define __STDC_CONSTANT_MACROS before "         "#including Support/DataTypes.h"
  ^
2 errors generated.

[Emil Velikov: add inline comment about the defines]
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoAndroid: drop static linking of R600 LLVM libraries
Mauro Rossi [Wed, 3 May 2017 19:35:13 +0000 (14:35 -0500)]
Android: drop static linking of R600 LLVM libraries

Inspired by Chih-Wei Huang and Zhen Wu similar patches

Linking against llvm with both static and shared may be avoided,
provided that libLLVM shared library for device supports
whole static R600/AMDGPU libraries, necessary for radeonsi/amdgpu.

Complementary changes, limited to android external/llvm project
are necessary to correclty build libLLVM

Tested with marshmallow-x86 and nougat-x86 builds

Reviewed-by: Chih-Wei Huang <cwhuang@linux.org.tw>
Signed-off-by: Rob Herring <robh@kernel.org>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoconfigure.ac: Fix help string for --disable-pwr8 configure option
Philipp Zabel [Wed, 10 May 2017 15:44:29 +0000 (17:44 +0200)]
configure.ac: Fix help string for --disable-pwr8 configure option

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
7 years agomesa: remove _CurrentFragmentProgram from gl_pipeline_object
Timothy Arceri [Wed, 10 May 2017 00:37:35 +0000 (10:37 +1000)]
mesa: remove _CurrentFragmentProgram from gl_pipeline_object

This was added in b527dd65c830a as a work around because fixed function
fragment shaders were tracked in ctx->FragmentProgram._Current as
a gl_program rather than gl_shader_program.

However after my refactoring of the program and shader structs
at the end of 2016 which culminated in c505d6d85222, we no longer
need gl_shader_program to track the current program making
_CurrentFragmentProgram obsolete.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agomesa: add KHR_no_error support for FramebufferTexture*D functions
Timothy Arceri [Mon, 8 May 2017 01:10:58 +0000 (11:10 +1000)]
mesa: add KHR_no_error support for FramebufferTexture*D functions

Reviewed-by: Eric Anholt <eric@anholt.net>
7 years agomesa: add no error version of framebuffer_texture_with_dims()
Timothy Arceri [Mon, 8 May 2017 00:59:15 +0000 (10:59 +1000)]
mesa: add no error version of framebuffer_texture_with_dims()

Reviewed-by: Eric Anholt <eric@anholt.net>
7 years agomesa: add error version of get_texture_for_framebuffer()
Timothy Arceri [Fri, 5 May 2017 06:25:11 +0000 (16:25 +1000)]
mesa: add error version of get_texture_for_framebuffer()

This is a step towards KHR_no_error support.

Reviewed-by: Eric Anholt <eric@anholt.net>
7 years agomesa: pass rb attachment to _mesa_framebuffer_texture()
Timothy Arceri [Fri, 5 May 2017 07:00:34 +0000 (17:00 +1000)]
mesa: pass rb attachment to _mesa_framebuffer_texture()

This change will help us add KHR_no_error support to the caller.

Reviewed-by: Eric Anholt <eric@anholt.net>
7 years agomesa: add _mesa_get_and_validate_attachment() helper
Timothy Arceri [Fri, 5 May 2017 06:46:03 +0000 (16:46 +1000)]
mesa: add _mesa_get_and_validate_attachment() helper

Will be used to add KHR_no_error support. We make this available
external so it can be called from meta.

Reviewed-by: Eric Anholt <eric@anholt.net>
7 years agomesa: remove _mesa_problem() from a few locations
Timothy Arceri [Fri, 5 May 2017 05:39:15 +0000 (15:39 +1000)]
mesa: remove _mesa_problem() from a few locations

_mesa_problem() is still useful in some places such as is if a backend
compile fails, but for the majority of cases we should be able to
remove it.

OpenGL test suites are becoming very mature, we should place more
trust in debug builds picking up missed cases.

Reviewed-by: Eric Anholt <eric@anholt.net>
7 years agomesa: make _mesa_get_framebuffer_attachment_parameter() static
Timothy Arceri [Fri, 5 May 2017 05:21:22 +0000 (15:21 +1000)]
mesa: make _mesa_get_framebuffer_attachment_parameter() static

Reviewed-by: Eric Anholt <eric@anholt.net>
7 years agomesa: fix indentation
Timothy Arceri [Fri, 5 May 2017 05:09:37 +0000 (15:09 +1000)]
mesa: fix indentation

Reviewed-by: Eric Anholt <eric@anholt.net>
7 years agomesa: remove _mesa from static framebuffer object function
Timothy Arceri [Fri, 5 May 2017 05:02:20 +0000 (15:02 +1000)]
mesa: remove _mesa from static framebuffer object function

Reviewed-by: Eric Anholt <eric@anholt.net>
7 years agogallivm: Fix build against LLVM SVN >= r302589
Michel Dänzer [Wed, 10 May 2017 08:26:07 +0000 (17:26 +0900)]
gallivm: Fix build against LLVM SVN >= r302589

deregisterEHFrames doesn't take any parameters anymore.

Reviewed-by: Vedran Miletić <vedran@miletic.net>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agomesa: small _mesa_UseProgram() tidy up
Timothy Arceri [Wed, 3 May 2017 05:56:03 +0000 (15:56 +1000)]
mesa: small _mesa_UseProgram() tidy up

Makes the code easier to follow.

Reviewed-by: Eric Anholt <eric@anholt.net>
7 years agomesa: add KHR_no_error support for glBindProgramPipeline()
Timothy Arceri [Wed, 3 May 2017 05:34:52 +0000 (15:34 +1000)]
mesa: add KHR_no_error support for glBindProgramPipeline()

Reviewed-by: Eric Anholt <eric@anholt.net>
7 years agomesa: add KHR_no_error support for glActiveShaderProgram()
Timothy Arceri [Wed, 3 May 2017 05:26:22 +0000 (15:26 +1000)]
mesa: add KHR_no_error support for glActiveShaderProgram()

Reviewed-by: Eric Anholt <eric@anholt.net>
7 years agomesa: add KHR_no_error support for glUseProgramStages()
Timothy Arceri [Wed, 3 May 2017 04:20:26 +0000 (14:20 +1000)]
mesa: add KHR_no_error support for glUseProgramStages()

Reviewed-by: Eric Anholt <eric@anholt.net>
7 years agomesa: create use_program_stages() helper
Timothy Arceri [Wed, 3 May 2017 03:50:21 +0000 (13:50 +1000)]
mesa: create use_program_stages() helper

This will be used to create a KHR_no_error version of
glUseProgramStages().

Reviewed-by: Eric Anholt <eric@anholt.net>
7 years agoradv: handle fragment shader srgb resolve pass better
Dave Airlie [Thu, 11 May 2017 00:05:58 +0000 (10:05 +1000)]
radv: handle fragment shader srgb resolve pass better

Bas pointed out the fs key doesn't take srgb into account,
since there is just one srgb variant, just create a separate
pipeline for it. This also uses dest format to be more consistent
on when srgb matters.

Fixes: 69136f4e633 "radv/meta: add resolve pass using fragment/vertex shaders"
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoi965: Make INTEL_DEBUG=bat decode VS/CLIP/GS/SF/WM/CC_STATE on Gen4-5.
Kenneth Graunke [Thu, 4 May 2017 05:07:16 +0000 (22:07 -0700)]
i965: Make INTEL_DEBUG=bat decode VS/CLIP/GS/SF/WM/CC_STATE on Gen4-5.

This is something the original decoder did, but I didn't bother with
until now.  I recently had to debug an Ironlake issue, and wanted to
inspect VS_STATE.  So, now it's back.

The other packets in the switch statement are all Gen6/7+, where we
use offsets from dynamic state base address, so we don't need the
gtt_offset subtraction introduced here.  We might want to make a
helper for this hack at some point - perhaps when we introduce the
next occurance.

Acked-by: Jason Ekstrand <jason@jlekstrand.net>
7 years agoi965: Switch BRW_NEW_CURBE_OFFSETS to BRW_NEW_PUSH_CONSTANT_ALLOCATION.
Kenneth Graunke [Mon, 8 May 2017 05:50:20 +0000 (22:50 -0700)]
i965: Switch BRW_NEW_CURBE_OFFSETS to BRW_NEW_PUSH_CONSTANT_ALLOCATION.

The BRW_NEW_CURBE_OFFSETS dirty bit is signalled when changing the
partitioning of the Constant Buffer URB section between the various
shader stages, on Gen4-5.

BRW_NEW_PUSH_CONSTANT_ALLOCATION is basically the same thing on Gen7+.

So, save a bit, and use the new name.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agoi965: Drop BRW_NEW_PUSH_CONSTANT_ALLOCATION from Gen6 code.
Kenneth Graunke [Mon, 8 May 2017 05:59:38 +0000 (22:59 -0700)]
i965: Drop BRW_NEW_PUSH_CONSTANT_ALLOCATION from Gen6 code.

Gen6 doesn't have a configurable push constant region.  This is only
used on Gen7+.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agoi965: Only #if...#endif a single function or related section at a time.
Kenneth Graunke [Mon, 1 May 2017 22:51:41 +0000 (15:51 -0700)]
i965: Only #if...#endif a single function or related section at a time.

Previously we guarded large swathes of code with #if GEN ... #endif
blocks.  This made it difficult to see which generations include what.

This patch splits up the #if..#endif sections so they surround a small
section of code - usually a single function/atom, or sometimes a group
of related functions.  It should make the code easier to work on.

Reviewed-by: Rafael Antognolli <rafael.antognolli@intel.com>
7 years agoi965: Turn brw_get_line_width_float() into brw_get_line_width().
Kenneth Graunke [Tue, 9 May 2017 05:39:25 +0000 (22:39 -0700)]
i965: Turn brw_get_line_width_float() into brw_get_line_width().

Drop the old brw_get_line_width() helper which return the unsigned
fixed-point encoding of the line width - it's been dead since the
conversion to GENXML (which does the encoding for us).

Then rename brw_get_line_width_float() to the shorter name.

Reviewed-by: Rafael Antognolli <rafael.antognolli@intel.com>
7 years agoi965: Drop INTEL_DEBUG=stats.
Kenneth Graunke [Tue, 9 May 2017 06:53:36 +0000 (23:53 -0700)]
i965: Drop INTEL_DEBUG=stats.

For whatever reason, we had an INTEL_DEBUG=stats option that enabled
various statistics counters on Gen4-5 systems.  It's been around
forever, though I can't think of a single time that it's been useful.

On Gen6+, we enable statistics all the time because they're necessary
to support various query object targets.  Turning them off would break
those queries.

Gen4-5 don't support those queries, so the statistics counters generally
aren't useful; we disabled them by default.  This patch disables them
altogether.

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
7 years agoi965: Disable ARB_pipeline_statistics_query on Gen4-5.
Kenneth Graunke [Tue, 9 May 2017 06:41:31 +0000 (23:41 -0700)]
i965: Disable ARB_pipeline_statistics_query on Gen4-5.

We apparently enabled this on all platforms in Mesa 10.6.  However, it
was only ever implemented for Gen6+.  The Gen4-5 query code goes up in
flames with an "Unrecognized query target" unreachable() error if you
even attempt to use any of the new functionality.

This wasn't caught because the Piglit tests require OpenGL 3.0, which
Gen4-5 cannot support.  The extension spec does say 3.0 is required,
though I'm not sure why - it seems like 2.1 would work fine.

We could implement it anyway, but it's a little bit of a pain due to the
lack of hardware contexts (so we have to snapshot around batches).

Given that it's been 100% broken for two years and I haven't seen a bug
report about it, I'm not terribly inclined to care.  So, let it go.

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
7 years agoradeonsi: add new vega10 pci ids
Alex Deucher [Wed, 10 May 2017 15:40:01 +0000 (11:40 -0400)]
radeonsi: add new vega10 pci ids

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Cc: 17.1 <mesa-stable@lists.freedesktop.org>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agost/mesa: move the logic of all_varyings_in_vbos into st_update_array
Marek Olšák [Mon, 8 May 2017 00:15:08 +0000 (02:15 +0200)]
st/mesa: move the logic of all_varyings_in_vbos into st_update_array

The function was pretty slow. This brings a substantial decrease in draw
call overhead when min/max index bounds are not needed:

Before:  DrawElements (1 VBO) w/ no state change:          5.75 million
After:   DrawElements (1 VBO) w/ no state change:          7.03 million

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agost/mesa: unify common code in st_draw_vbo functions
Marek Olšák [Mon, 8 May 2017 00:11:31 +0000 (02:11 +0200)]
st/mesa: unify common code in st_draw_vbo functions

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agost/mesa: make st_draw_vbo static
Marek Olšák [Mon, 8 May 2017 00:08:17 +0000 (02:08 +0200)]
st/mesa: make st_draw_vbo static

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi: remove upload code for zero-stride vertex attribs
Marek Olšák [Sat, 29 Apr 2017 23:24:29 +0000 (01:24 +0200)]
radeonsi: remove upload code for zero-stride vertex attribs

st/mesa takes care of it now.

Tested-by: Edmondo Tommasina <edmondo.tommasina@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
7 years agost/mesa: upload zero-stride vertex attributes here
Marek Olšák [Sat, 29 Apr 2017 23:20:19 +0000 (01:20 +0200)]
st/mesa: upload zero-stride vertex attributes here

This is the best place to do it. Now drivers without u_vbuf don't have to
do it.

v2: use correct upload size and optimal alignment

Tested-by: Edmondo Tommasina <edmondo.tommasina@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agogallium: add PIPE_CAP_CAN_BIND_CONST_BUFFER_AS_VERTEX
Marek Olšák [Sat, 29 Apr 2017 23:18:43 +0000 (01:18 +0200)]
gallium: add PIPE_CAP_CAN_BIND_CONST_BUFFER_AS_VERTEX

The next patch will use it. This is really for svga and GL2-level drivers.

Tested-by: Edmondo Tommasina <edmondo.tommasina@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
7 years agost/mesa: simplify the signature of get_client_array
Marek Olšák [Sun, 30 Apr 2017 12:57:35 +0000 (14:57 +0200)]
st/mesa: simplify the signature of get_client_array

Tested-by: Edmondo Tommasina <edmondo.tommasina@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agost/mesa: remove vpv->num_inputs dereferences in st_update_array
Marek Olšák [Sun, 30 Apr 2017 12:42:45 +0000 (14:42 +0200)]
st/mesa: remove vpv->num_inputs dereferences in st_update_array

Tested-by: Edmondo Tommasina <edmondo.tommasina@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agost/mesa: fold error handling into setup_(non_)interleaved_attribs
Marek Olšák [Sun, 30 Apr 2017 12:42:45 +0000 (14:42 +0200)]
st/mesa: fold error handling into setup_(non_)interleaved_attribs

Tested-by: Edmondo Tommasina <edmondo.tommasina@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agost/mesa: fold cso calls into setup_(non_)interleaved_attribs
Marek Olšák [Sun, 30 Apr 2017 12:42:45 +0000 (14:42 +0200)]
st/mesa: fold cso calls into setup_(non_)interleaved_attribs

Tested-by: Edmondo Tommasina <edmondo.tommasina@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agost/mesa: don't call util_draw_init_info in st_draw_vbo
Marek Olšák [Sun, 9 Apr 2017 11:17:54 +0000 (13:17 +0200)]
st/mesa: don't call util_draw_init_info in st_draw_vbo

7 years agogallium: remove pipe_index_buffer and set_index_buffer
Marek Olšák [Sun, 2 Apr 2017 14:24:39 +0000 (16:24 +0200)]
gallium: remove pipe_index_buffer and set_index_buffer

pipe_draw_info::indexed is replaced with index_size. index_size == 0 means
non-indexed.

Instead of pipe_index_buffer::offset, pipe_draw_info::start is used.
For indexed indirect draws, pipe_draw_info::start is added to the indirect
start. This is the only case when "start" affects indirect draws.

pipe_draw_info::index is a union. Use either index::resource or
index::user depending on the value of pipe_draw_info::has_user_indices.

v2: fixes for nine, svga

7 years agogallium: separate indirect stuff from pipe_draw_info - 80 -> 56 bytes
Marek Olšák [Sun, 2 Apr 2017 13:24:19 +0000 (15:24 +0200)]
gallium: separate indirect stuff from pipe_draw_info - 80 -> 56 bytes

For faster initialization of non-indirect draws.

7 years agogallium: decrease the size of pipe_vertex_buffer - 24 -> 16 bytes
Marek Olšák [Sun, 2 Apr 2017 12:30:16 +0000 (14:30 +0200)]
gallium: decrease the size of pipe_vertex_buffer - 24 -> 16 bytes

7 years agodocs: add news item and link release notes for 17.1.0
Emil Velikov [Wed, 10 May 2017 14:24:03 +0000 (15:24 +0100)]
docs: add news item and link release notes for 17.1.0

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
7 years agodocs: add sha256 checksums for 17.1.0
Emil Velikov [Wed, 10 May 2017 14:20:37 +0000 (15:20 +0100)]
docs: add sha256 checksums for 17.1.0

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
(cherry picked from commit 806f802e7b6a898a4f8c47bc56b97579a86a873e)

7 years agodocs: Update 17.1.0 release notes
Emil Velikov [Wed, 10 May 2017 11:11:03 +0000 (12:11 +0100)]
docs: Update 17.1.0 release notes

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
(cherry picked from commit 15a38605fc3aa49c01943f9ec2be19d58fef4aac)

7 years agost/glsl_to_tgsi: make sure resource file for samplers is PROGRAM_SAMPLER
Samuel Pitoiset [Fri, 5 May 2017 13:36:27 +0000 (15:36 +0200)]
st/glsl_to_tgsi: make sure resource file for samplers is PROGRAM_SAMPLER

Similar to how image resources are handled. That way we are sure
that inst->resource.file is PROGRAM_SAMPLER for "bound" samplers.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi: silent a compiler warning
Samuel Pitoiset [Wed, 10 May 2017 10:20:41 +0000 (12:20 +0200)]
radeonsi: silent a compiler warning

This fixes:

si_shader.c: In function ‘si_shader_dump_stats’:
si_shader.c:6704:31: warning: passing argument 1 of ‘si_get_max_workgroup_size’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
     si_get_max_workgroup_size(shader);
                               ^~~~~~
si_shader.c:5832:17: note: expected ‘struct si_shader *’ but argument is of type ‘const struct si_shader *’
 static unsigned si_get_max_workgroup_size(struct si_shader *shader)

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agomesa: use u_bit_scan() in update_program_texture_state()
Samuel Pitoiset [Tue, 9 May 2017 21:33:27 +0000 (23:33 +0200)]
mesa: use u_bit_scan() in update_program_texture_state()

The check in update_single_program_texture() can also be
removed.

v2: - remove unused 's' variable

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agomesa: remove never used gl_shader_compiler_options::EmitNoFunctions
Samuel Pitoiset [Mon, 8 May 2017 20:54:06 +0000 (22:54 +0200)]
mesa: remove never used gl_shader_compiler_options::EmitNoFunctions

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Elie Tournier <elie.tournier@collabora.com>
7 years agoradeonsi: dump compute descriptor lists
Nicolai Hähnle [Mon, 8 May 2017 11:10:02 +0000 (13:10 +0200)]
radeonsi: dump compute descriptor lists

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoradeonsi: dump both enabled and required descriptor slots
Nicolai Hähnle [Mon, 8 May 2017 11:10:35 +0000 (13:10 +0200)]
radeonsi: dump both enabled and required descriptor slots

This allows a meaningful dump with info == NULL (for compute shaders).

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoradeonsi: dump compute shader as part of debug dump
Nicolai Hähnle [Mon, 8 May 2017 11:01:37 +0000 (13:01 +0200)]
radeonsi: dump compute shader as part of debug dump

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoradeonsi: move struct si_compute into a header
Nicolai Hähnle [Mon, 8 May 2017 11:01:18 +0000 (13:01 +0200)]
radeonsi: move struct si_compute into a header

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoradeonsi: split descriptor list dumping
Nicolai Hähnle [Mon, 8 May 2017 11:02:33 +0000 (13:02 +0200)]
radeonsi: split descriptor list dumping

Prepare for dumping CS descriptor list.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoradeonsi: split shader dumping
Nicolai Hähnle [Mon, 8 May 2017 11:00:12 +0000 (13:00 +0200)]
radeonsi: split shader dumping

Prepare for dumping compute shaders.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoradeonsi: more const qualifiers in shader dump functions
Nicolai Hähnle [Mon, 8 May 2017 10:59:26 +0000 (12:59 +0200)]
radeonsi: more const qualifiers in shader dump functions

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoddebug: implement dd_dump_launch_grid
Nicolai Hähnle [Mon, 8 May 2017 11:29:50 +0000 (13:29 +0200)]
ddebug: implement dd_dump_launch_grid

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoddebug: extract dd_dump_shader
Nicolai Hähnle [Mon, 8 May 2017 11:29:33 +0000 (13:29 +0200)]
ddebug: extract dd_dump_shader

Will be re-used for compute shaders.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agogallium/util: dump tokens in util_dump_shader_state only if type is TGSI
Nicolai Hähnle [Mon, 8 May 2017 15:29:03 +0000 (17:29 +0200)]
gallium/util: dump tokens in util_dump_shader_state only if type is TGSI

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agogallium/util: add util_dump_grid_info
Nicolai Hähnle [Mon, 8 May 2017 11:29:02 +0000 (13:29 +0200)]
gallium/util: add util_dump_grid_info

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoradv: always free nir shaders from modules on stack
Grazvydas Ignotas [Tue, 2 May 2017 19:46:06 +0000 (22:46 +0300)]
radv: always free nir shaders from modules on stack

valgrind reports them as leaked, and I could not find anything making a
copy of the nir pointer. Also, radv_device_init_meta_blit_color() is
already freeing them unconditionally like this.

Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
7 years agoanv: don't leak DRM devices
Grazvydas Ignotas [Tue, 2 May 2017 17:11:06 +0000 (20:11 +0300)]
anv: don't leak DRM devices

After successful drmGetDevices2() call, drmFreeDevices() needs to be
called.

Fixes: b1fb6e8d "anv: do not open random render node(s)"
Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl> # radv version
7 years agoanv: fix possible stack corruption
Grazvydas Ignotas [Tue, 2 May 2017 16:26:17 +0000 (19:26 +0300)]
anv: fix possible stack corruption

drmGetDevices2 takes count and not size. Probably hasn't caused problems
yet in practice and was missed as setups with more than 8 DRM devices
are not very common.

Fixes: b1fb6e8d "anv: do not open random render node(s)"
Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
7 years agoi965/vec4: Delete the system value infastructure
Jason Ekstrand [Fri, 5 May 2017 21:31:41 +0000 (14:31 -0700)]
i965/vec4: Delete the system value infastructure

The only thing still using it is INVOCATION_ID for geometry shaders.
That's easily enough inlined into the nir_intrinsic_load_invocation_id
handling code.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965/vec4: Use NIR to do GS input remapping
Jason Ekstrand [Thu, 4 May 2017 23:36:26 +0000 (16:36 -0700)]
i965/vec4: Use NIR to do GS input remapping

We're already doing this in the FS back-end.  This just does the same
thing in the vec4 back-end.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965/fs: Move remapping of gl_PointSize to the NIR level
Jason Ekstrand [Thu, 4 May 2017 23:33:32 +0000 (16:33 -0700)]
i965/fs: Move remapping of gl_PointSize to the NIR level

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965/nir: Inline remap_inputs_with_vue_map
Jason Ekstrand [Thu, 4 May 2017 21:57:52 +0000 (14:57 -0700)]
i965/nir: Inline remap_inputs_with_vue_map

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965/vec4: Use NIR remapping for VS attributes
Jason Ekstrand [Thu, 4 May 2017 00:40:54 +0000 (17:40 -0700)]
i965/vec4: Use NIR remapping for VS attributes

The NIR pass already handles remapping system values to attributes for
us so we delete the system value code as part of the conversion.

We also change nir_lower_vs_inputs to take an explicit inputs_read
bitmask and pass in the inputs_read from prog_data instead from pulling
it out of NIR.  This is because the version in prog_data may get
EDGEFLAG added to it on some old platforms.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agointel/compiler/vs: Move inputs_read handling to generic code
Jason Ekstrand [Thu, 4 May 2017 21:50:20 +0000 (14:50 -0700)]
intel/compiler/vs: Move inputs_read handling to generic code

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965/vec4: Set VERT_BIT_EDGEFLAG based on the VUE map
Jason Ekstrand [Tue, 9 May 2017 19:34:10 +0000 (12:34 -0700)]
i965/vec4: Set VERT_BIT_EDGEFLAG based on the VUE map

We also add a nice little comment to make it more clear exactly what
happens with the edge flag copy.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965/fs: Lower gl_VertexID and friends to inputs at the NIR level
Jason Ekstrand [Wed, 3 May 2017 23:53:40 +0000 (16:53 -0700)]
i965/fs: Lower gl_VertexID and friends to inputs at the NIR level

NIR calls these system values but they come in from the VF unit as
vertex data.  It's terribly convenient to just be able to treat them as
such in the back-end.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965/vs: Set uses_vertexid and friends from brw_compile_vs
Jason Ekstrand [Thu, 4 May 2017 00:24:43 +0000 (17:24 -0700)]
i965/vs: Set uses_vertexid and friends from brw_compile_vs

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: Move multiply by 4 for VS ATTR setup into the scalar backend.
Jason Ekstrand [Wed, 3 May 2017 23:56:15 +0000 (16:56 -0700)]
i965: Move multiply by 4 for VS ATTR setup into the scalar backend.

The vec4 backend will want to count in units of vec4s, not scalar
components.  The simplest solution is to move the multiplication by 4
into the scalar backend.  This also improves consistency with how we
count varyings.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965/nir: Inline remap_vs_attrs
Jason Ekstrand [Wed, 3 May 2017 23:41:43 +0000 (16:41 -0700)]
i965/nir: Inline remap_vs_attrs

Now that we have nice block iterators, there's no good reason for this
to be off on it's own.  While we're here, we convert to using the NIR
const index getters/setters instead of whacking const_index values
directly.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agonir: Embed the shader_info in the nir_shader again
Jason Ekstrand [Mon, 8 May 2017 16:20:21 +0000 (09:20 -0700)]
nir: Embed the shader_info in the nir_shader again

Commit e1af20f18a86f52a9640faf2d4ff8a71b0a4fa9b changed the shader_info
from being embedded into being just a pointer.  The idea was that
sharing the shader_info between NIR and GLSL would be easier if it were
a pointer pointing to the same shader_info struct.  This, however, has
caused a few problems:

 1) There are many things which generate NIR without GLSL.  This means
    we have to support both NIR shaders which come from GLSL and ones
    that don't and need to have an info elsewhere.

 2) The solution to (1) raises all sorts of ownership issues which have
    to be resolved with ralloc_parent checks.

 3) Ever since 00620782c92100d77c660f9783504c6d80fa1d58, we've been
    using nir_gather_info to fill out the final shader_info.  Thanks to
    cloning and the above ownership issues, the nir_shader::info may not
    point back to the gl_shader anymore and so we have to do a copy of
    the shader_info from NIR back to GLSL anyway.

All of these issues go away if we just embed the shader_info in the
nir_shader.  There's a little downside of having to copy it back after
calling nir_gather_info but, as explained above, we have to do that
anyway.

Acked-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agomesa: Make _mesa_primitive_restart_index a static inline in the header.
Kenneth Graunke [Sat, 6 May 2017 23:11:03 +0000 (16:11 -0700)]
mesa: Make _mesa_primitive_restart_index a static inline in the header.

It's now basically a single expression, so it probably makes sense to
have it inlined into the callers.

Suggested by Marek.

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agofreedreno: fix clang error in fd_get_compute_param
Rob Herring [Tue, 9 May 2017 16:56:49 +0000 (11:56 -0500)]
freedreno: fix clang error in fd_get_compute_param

With commit 10c17f23b752 ("freedreno: core compute state support"),
Android builds fail with the following error:

external/mesa3d/src/gallium/drivers/freedreno/freedreno_screen.c:610:17: error: format string is not a string literal (potentially insecure) [-Werror,-Wformat-security]
                        sprintf(ret, ir);
                                     ^~

Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
7 years agomesa/vbo: fix invalid min/max indexes
Rob Clark [Mon, 8 May 2017 20:31:56 +0000 (16:31 -0400)]
mesa/vbo: fix invalid min/max indexes

Fixes: c3f37e9b ("st/mesa: use min_index and max_index directly from vbo")
Signed-off-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
7 years agointel: compiler: prevent integer overflow
Lionel Landwerlin [Mon, 8 May 2017 17:55:06 +0000 (18:55 +0100)]
intel: compiler: prevent integer overflow

CID: 13994771399478 (Integer handling issues)

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
7 years agointel: compiler: remove duplicated code
Lionel Landwerlin [Mon, 8 May 2017 17:50:53 +0000 (18:50 +0100)]
intel: compiler: remove duplicated code

CID: 1399470: (Control flow issues)

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
7 years agointel: gen decoder: don't check for size_t negative values
Lionel Landwerlin [Mon, 8 May 2017 17:47:06 +0000 (18:47 +0100)]
intel: gen decoder: don't check for size_t negative values

We should get either 0 or 1 here.

CID: 1373562 (Control flow issues)

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Acked-by: Matt Turner <mattst88@gmail.com>
7 years agobin/*py: honor editorconfig formatting
Andres Gomez [Fri, 5 May 2017 13:09:42 +0000 (16:09 +0300)]
bin/*py: honor editorconfig formatting

Replace the two stray tabs with respective space.

Signed-off-by: Andres Gomez <agomez@igalia.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agobin: use tabs for coding style on *.sh files
Andres Gomez [Fri, 5 May 2017 14:49:52 +0000 (17:49 +0300)]
bin: use tabs for coding style on *.sh files

v2: Instead of changing *.sh, adapt the editorconfig file (Emil).

Signed-off-by: Andres Gomez <agomez@igalia.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoandroid: i965: add per-gen libmesa_i965_gen{4,45,5} static
Mauro Rossi [Sat, 6 May 2017 14:03:23 +0000 (16:03 +0200)]
android: i965: add per-gen libmesa_i965_gen{4,45,5} static

Needed to fix android building errors:

external/mesa/src/mesa/drivers/dri/i965/brw_state_upload.c:148: error: undefined reference to 'gen5_init_atoms'
external/mesa/src/mesa/drivers/dri/i965/brw_state_upload.c:150: error: undefined reference to 'gen45_init_atoms'
external/mesa/src/mesa/drivers/dri/i965/brw_state_upload.c:152: error: undefined reference to 'gen4_init_atoms'
clang++: error: linker command failed with exit code 1 (use -v to see invocation)

Fixes: 5a19d0b ("i965: Get real per-gen atom lists")
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>