mesa.git
8 years agoradv/ac/llvm: trim texture return values
Dave Airlie [Mon, 24 Oct 2016 20:53:03 +0000 (06:53 +1000)]
radv/ac/llvm: trim texture return values

The intrinsic engine asserts in llvm due to this,
as we put a vec4 into a vec1, and the next instruction
isn't expecting it.

So trim the vector at the end before inserting it.

Reported-by: Christoph Haag <haagch+mesadev@frickel.club>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Cc: "13.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agoglsl: Add pthread libs to cache_test
Rhys Kidd [Wed, 26 Oct 2016 04:13:24 +0000 (00:13 -0400)]
glsl: Add pthread libs to cache_test

Fixes the following compile error, present when the SHA1 library is libgcrypt:

  CCLD     glsl/tests/cache-test
glsl/.libs/libglsl.a(libmesautil_la-mesa-sha1.o): In function `call_once':
/mesa/src/util/../../include/c11/threads_posix.h:96: undefined reference to `pthread_once'

Signed-off-by: Rhys Kidd <rhyskidd@gmail.com>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
8 years agogenxml: Handle failure of Python codegen scripts.
Matt Turner [Wed, 26 Oct 2016 19:51:32 +0000 (12:51 -0700)]
genxml: Handle failure of Python codegen scripts.

8 years agonvc0/ir: fix emission of SHLADD with NEG modifiers
Samuel Pitoiset [Fri, 21 Oct 2016 15:43:00 +0000 (17:43 +0200)]
nvc0/ir: fix emission of SHLADD with NEG modifiers

This affects GF100:GK110 chipsets, but not GM107+ where the
logic is a bit different. The emitters tried to emit sub
instead of subr when src0 has a NEG modifier.

This fixes the following piglit tests glsl-fs-loop-nested
and glsl-vs-loop-nested.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Acked-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "13.0" <mesa-stable@lists.freedesktop.org>
8 years agocompiler: avoid warning about redefinition of PYTHON_GEN
Erik Faye-Lund [Wed, 26 Oct 2016 13:09:54 +0000 (15:09 +0200)]
compiler: avoid warning about redefinition of PYTHON_GEN

PYTHON_GEN is defined to the exact same thing in both
Makefile.glsl.am and Makefile.nir.am. This makes automake complain,
so let's lift the definition up to Makefile.am, the same way as
MKDIR_GEN.

Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Tested-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
8 years agoegl/dri2: swap_buffers_with_damage falls back to swap_buffers
Eric Engestrom [Mon, 24 Oct 2016 22:41:00 +0000 (23:41 +0100)]
egl/dri2: swap_buffers_with_damage falls back to swap_buffers

Since commit 0a606a400fe3 ("egl: add eglSwapBuffersWithDamageKHR"),
Android has been broken because the function eglSwapBuffersWithDamageKHR
is provided regardless of the extension being present. Also, the Android
meta-EGL always advertises the extension regardless of the underlying
EGL implementation. As there doesn't seem to be a simple way
conditionally make the EGL function ptr NULL, just implement a brain
dead version of eglSwapBuffersWithDamage{KHR,EXT}.

Cc: 13.0 <mesa-stable@lists.freedesktop.org>
CC: Rob Clark <robdclark@gmail.com>
Suggested-by: Emil Velikov <emil.velikov@collabora.com>
Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Rob Herring <robh@kernel.org>
[Emil Velikov: copy the original commit message from Rob's patch]
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
8 years agocompiler: automake: add shader_info.h to the sources list
Emil Velikov [Wed, 26 Oct 2016 11:02:27 +0000 (12:02 +0100)]
compiler: automake: add shader_info.h to the sources list

Otherwise it'll be missing from the tarball.

Fixes: 094fe3a9591 ("nir: move nir_shader_info to a common compiler header")
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
8 years agoconfigure.ac: simplify EGL requirements for drivers dependent on EGL
Marek Olšák [Tue, 18 Oct 2016 21:47:01 +0000 (23:47 +0200)]
configure.ac: simplify EGL requirements for drivers dependent on EGL

Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
8 years agost/mesa: allow multiple concurrent waiters in ClientWaitSync
Marek Olšák [Tue, 25 Oct 2016 11:10:49 +0000 (13:10 +0200)]
st/mesa: allow multiple concurrent waiters in ClientWaitSync

so->fence can be unreferenced by one thread while another thread is
somewhere in ClientWaitSync and expecting so->fence to be non-NULL.

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

Cc: 12.0 13.0 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agost/mesa: unduplicate st_check_sync code
Marek Olšák [Tue, 25 Oct 2016 10:58:03 +0000 (12:58 +0200)]
st/mesa: unduplicate st_check_sync code

It's the same as st_client_wait_sync. Discovered by Michel.
This is needed to make the following fix simpler.

Cc: 12.0 13.0 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agoradeonsi: remove si_resource_create_custom
Marek Olšák [Mon, 24 Oct 2016 21:29:50 +0000 (23:29 +0200)]
radeonsi: remove si_resource_create_custom

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agogallium/radeon: stop using PIPE_BIND_CUSTOM
Marek Olšák [Mon, 24 Oct 2016 21:26:39 +0000 (23:26 +0200)]
gallium/radeon: stop using PIPE_BIND_CUSTOM

it has no effect whatsoever

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agor600g: remove a redundant buffer_create helper
Marek Olšák [Mon, 24 Oct 2016 00:21:38 +0000 (02:21 +0200)]
r600g: remove a redundant buffer_create helper

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agogallium/radeon: remove unused r600_cmask_info members
Marek Olšák [Mon, 24 Oct 2016 16:29:43 +0000 (18:29 +0200)]
gallium/radeon: remove unused r600_cmask_info members

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agogallium/radeon: don't force the same tiling parameters for FMASK
Marek Olšák [Mon, 24 Oct 2016 16:22:31 +0000 (18:22 +0200)]
gallium/radeon: don't force the same tiling parameters for FMASK

GCN can use a completely different tile mode for FMASK.

FMASK allocation now skips one unrelated amdgpu_surface_init codepath as
hinted by the assertion.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agowinsys/amdgpu: allocate FMASK properly
Marek Olšák [Mon, 24 Oct 2016 16:01:52 +0000 (18:01 +0200)]
winsys/amdgpu: allocate FMASK properly

I expect no change in behavior, because r600_texture.c forces the same
tile mode as the base texture has.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agogallium/radeon: print tiling index when printing texture info
Marek Olšák [Mon, 24 Oct 2016 15:57:19 +0000 (17:57 +0200)]
gallium/radeon: print tiling index when printing texture info

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agogallium/radeon: don't do (fmask.size && cmask.size)
Marek Olšák [Sun, 23 Oct 2016 23:31:05 +0000 (01:31 +0200)]
gallium/radeon: don't do (fmask.size && cmask.size)

fmask implies that cmask is present too.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agogallium/radeon: re-order radeon_surf::dcc and htile members
Marek Olšák [Sun, 23 Oct 2016 19:28:29 +0000 (21:28 +0200)]
gallium/radeon: re-order radeon_surf::dcc and htile members

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agogallium/radeon: rename bo_size -> surf_size, bo_alignment -> surf_alignment
Marek Olšák [Sun, 23 Oct 2016 19:26:43 +0000 (21:26 +0200)]
gallium/radeon: rename bo_size -> surf_size, bo_alignment -> surf_alignment

these names were misleading.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agogallium/radeon: remove flags specific to libdrm_radeon from winsys interface
Marek Olšák [Sun, 23 Oct 2016 19:03:40 +0000 (21:03 +0200)]
gallium/radeon: remove flags specific to libdrm_radeon from winsys interface

These just say whether libdrm can assume that the latest radeon_surface
definition is used by Mesa.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agogallium/radeon: remove r600_htile_info
Marek Olšák [Sun, 23 Oct 2016 14:43:22 +0000 (16:43 +0200)]
gallium/radeon: remove r600_htile_info

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agogallium/radeon: remove unnecessary fields from radeon_surf_level
Marek Olšák [Sun, 23 Oct 2016 14:09:58 +0000 (16:09 +0200)]
gallium/radeon: remove unnecessary fields from radeon_surf_level

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agogallium/radeon: decrease the size of radeon_surf
Marek Olšák [Sun, 23 Oct 2016 13:51:46 +0000 (15:51 +0200)]
gallium/radeon: decrease the size of radeon_surf

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agogallium/radeon: pass pipe_resource and other params to surface_init directly
Marek Olšák [Sun, 23 Oct 2016 18:17:32 +0000 (20:17 +0200)]
gallium/radeon: pass pipe_resource and other params to surface_init directly

This removes input-only parameters from the radeon_surf structure.

Some of the translation logic from pipe_resource to radeon_surf is moved to
winsys/radeon.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agoradeon/vce: use nblk_y instead of npix_y
Marek Olšák [Sun, 23 Oct 2016 18:11:17 +0000 (20:11 +0200)]
radeon/vce: use nblk_y instead of npix_y

npix_y will be removed. level[0].npix_y will be removed too. nblk_y should
be the same as npix_y if the block height == 1. However, nblk_y is aligned
to the tile size, so it can be greater than npix_y.

If that's a problem, we'll have to save the input height of surface_init
and use that.

Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agogallium/radeon: define RADEON_SURF_MODE_* as enums
Marek Olšák [Sun, 23 Oct 2016 18:07:39 +0000 (20:07 +0200)]
gallium/radeon: define RADEON_SURF_MODE_* as enums

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agogallium/radeon: stop using some input fields from radeon_surface
Marek Olšák [Sun, 23 Oct 2016 17:55:19 +0000 (19:55 +0200)]
gallium/radeon: stop using some input fields from radeon_surface

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agogallium/radeon: fold r600_setup_surface into r600_init_surface
Marek Olšák [Sun, 23 Oct 2016 17:18:46 +0000 (19:18 +0200)]
gallium/radeon: fold r600_setup_surface into r600_init_surface

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agowinsys/amdgpu: remove unused definitions
Marek Olšák [Fri, 21 Oct 2016 11:30:31 +0000 (13:30 +0200)]
winsys/amdgpu: remove unused definitions

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agogallium/radeon: fold radeon_winsys::surface_best into radeon/winsys
Marek Olšák [Thu, 20 Oct 2016 20:57:03 +0000 (22:57 +0200)]
gallium/radeon: fold radeon_winsys::surface_best into radeon/winsys

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agogallium/radeon: use r600_gfx_write_event_eop everywhere
Marek Olšák [Mon, 3 Oct 2016 13:37:19 +0000 (15:37 +0200)]
gallium/radeon: use r600_gfx_write_event_eop everywhere

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agogallium/radeon: make r600_gfx_write_fence more generic
Marek Olšák [Mon, 3 Oct 2016 13:32:36 +0000 (15:32 +0200)]
gallium/radeon: make r600_gfx_write_fence more generic

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agogallium/radeon: fix a ZPASS comment, EVENT_WRITE_EOP fixups
Marek Olšák [Mon, 3 Oct 2016 13:13:56 +0000 (15:13 +0200)]
gallium/radeon: fix a ZPASS comment, EVENT_WRITE_EOP fixups

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agoradeonsi: enable SDMA on Carrizo and all CIK chips again
Marek Olšák [Mon, 24 Oct 2016 17:32:31 +0000 (19:32 +0200)]
radeonsi: enable SDMA on Carrizo and all CIK chips again

SDMA might be fixed by:
  "winsys/amdgpu: fix radeon_surf::macro_tile_index for imported textures"

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agowinsys/amdgpu: fix radeon_surf::macro_tile_index for imported textures
Marek Olšák [Mon, 24 Oct 2016 17:05:10 +0000 (19:05 +0200)]
winsys/amdgpu: fix radeon_surf::macro_tile_index for imported textures

Maybe this is why SDMA has been broken for many amdgpu users?

SDMA is the only block which is used with imported textures and relies
on this variable. DB also uses it, but it doesn't get imported textures,
so it's unaffected.

I do get SDMA failures on Tonga before this patch if R600_DEBUG=testdma
is changed to use imported textures.

Cc: 11.2 12.0 13.0 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agogallium/radeon: make sure the address of separate CMASK is aligned properly
Marek Olšák [Mon, 24 Oct 2016 19:16:11 +0000 (21:16 +0200)]
gallium/radeon: make sure the address of separate CMASK is aligned properly

This should fix random GPU hangs on Hawaii and Fiji.

Cc: 11.2 12.0 13.0 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agogallium/radeon: fix incorrect bpe use in si_set_optimal_micro_tile_mode
Marek Olšák [Sun, 23 Oct 2016 13:29:18 +0000 (15:29 +0200)]
gallium/radeon: fix incorrect bpe use in si_set_optimal_micro_tile_mode

Oh my god, I wonder what catastrophic issues this was causing on SI.

Cc: 13.0 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agoglsl: update default precision qualifier when it is set in the shader
Samuel Iglesias Gonsálvez [Fri, 21 Oct 2016 06:23:59 +0000 (08:23 +0200)]
glsl: update default precision qualifier when it is set in the shader

Default precision qualifier for a data type could be set several times
inside a shader. This patch allows to update the default precision
qualifier for the given type that is saved in the symbol table.

If it is not in the symbol table, just add it.

Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97804
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
8 years agomesa/program: Add _mesa_symbol_table_replace_symbol()
Samuel Iglesias Gonsálvez [Thu, 20 Oct 2016 07:04:59 +0000 (09:04 +0200)]
mesa/program: Add _mesa_symbol_table_replace_symbol()

This function allows to modify an existing symbol.

v2:
- Remove namespace usage now that it was deleted.

Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
8 years agonir: stop adjusting driver location for varying packing
Timothy Arceri [Mon, 24 Oct 2016 23:23:25 +0000 (10:23 +1100)]
nir: stop adjusting driver location for varying packing

As of 59864e8e020 we just use the location assigned by the front-end and
no longer need this for i965.

Since there were some issues in the logic with assigning arrays the same
driver location if they didn't start at the same location just remove it
and let other drivers implement a solution if needed when they add
ARB_enhanced_layouts support.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agocompiler: remove copy_shader_info()
Timothy Arceri [Thu, 20 Oct 2016 05:40:16 +0000 (16:40 +1100)]
compiler: remove copy_shader_info()

This temporary helper is no longer needed now that we have finished
refactoring common shader metadata.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agoglsl: set uses texture gather directly in shader_info
Timothy Arceri [Thu, 20 Oct 2016 05:37:27 +0000 (16:37 +1100)]
glsl: set uses texture gather directly in shader_info

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agoglsl/st/mesa: use common system values read field
Timothy Arceri [Thu, 20 Oct 2016 05:30:56 +0000 (16:30 +1100)]
glsl/st/mesa: use common system values read field

And set system values read directly in shader_info.

st/mesa changes where:
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agoglsl: set patch outputs written directly in shader_info
Timothy Arceri [Thu, 20 Oct 2016 05:25:28 +0000 (16:25 +1100)]
glsl: set patch outputs written directly in shader_info

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agost/mesa: use common patch outputs written field
Timothy Arceri [Thu, 20 Oct 2016 05:24:58 +0000 (16:24 +1100)]
st/mesa: use common patch outputs written field

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agoglsl: set patch inputs read directly in shader_info
Timothy Arceri [Thu, 20 Oct 2016 05:21:24 +0000 (16:21 +1100)]
glsl: set patch inputs read directly in shader_info

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agost/mesa: use common patch inputs read field
Timothy Arceri [Thu, 20 Oct 2016 05:19:34 +0000 (16:19 +1100)]
st/mesa: use common patch inputs read field

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agoglsl: set outputs read directly in shader_info
Timothy Arceri [Thu, 20 Oct 2016 05:17:23 +0000 (16:17 +1100)]
glsl: set outputs read directly in shader_info

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agor200/glsl/st/mesa: use common outputs written field
Timothy Arceri [Thu, 20 Oct 2016 04:27:35 +0000 (15:27 +1100)]
r200/glsl/st/mesa: use common outputs written field

And set outputs written directly in shader_info.

st/mesa changes where:
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agomesa/glsl: set double inputs read directly in shader_info
Timothy Arceri [Thu, 20 Oct 2016 04:21:06 +0000 (15:21 +1100)]
mesa/glsl: set double inputs read directly in shader_info

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agost/mesa: use common double inputs read field
Timothy Arceri [Thu, 20 Oct 2016 04:18:28 +0000 (15:18 +1100)]
st/mesa: use common double inputs read field

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agor200/i915/st/mesa/compiler: use common inputs read field
Timothy Arceri [Thu, 20 Oct 2016 03:24:03 +0000 (14:24 +1100)]
r200/i915/st/mesa/compiler: use common inputs read field

And set set inputs_read directly in shader_info.

To avoid regressions between changes this change is a squashed
version of the following patches.

st/mesa changes where:
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agomesa/compiler: copy early fragment tests to shader_info in _mesa_copy_linked_program_...
Timothy Arceri [Thu, 20 Oct 2016 03:09:15 +0000 (14:09 +1100)]
mesa/compiler: copy early fragment tests to shader_info in _mesa_copy_linked_program_data()

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agometa: remove remaining tabs in meta.c
Timothy Arceri [Wed, 19 Oct 2016 22:30:01 +0000 (09:30 +1100)]
meta: remove remaining tabs in meta.c

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agoi965: replace brw_compute_program with brw_program
Timothy Arceri [Tue, 18 Oct 2016 05:25:08 +0000 (16:25 +1100)]
i965: replace brw_compute_program with brw_program

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agoi965: replace brw_fragment_program with brw_program
Timothy Arceri [Tue, 18 Oct 2016 05:17:14 +0000 (16:17 +1100)]
i965: replace brw_fragment_program with brw_program

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agoi965: replace brw_tess_{eval,ctrl}_program with brw_program
Timothy Arceri [Tue, 18 Oct 2016 05:03:32 +0000 (16:03 +1100)]
i965: replace brw_tess_{eval,ctrl}_program with brw_program

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agoi965: replace brw_geomerty_program with brw_program
Timothy Arceri [Tue, 18 Oct 2016 04:43:21 +0000 (15:43 +1100)]
i965: replace brw_geomerty_program with brw_program

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agoi965: replace brw_vertex_program with new generic brw_program
Timothy Arceri [Tue, 18 Oct 2016 04:26:57 +0000 (15:26 +1100)]
i965: replace brw_vertex_program with new generic brw_program

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agost/mesa/r200/i915/i965: eliminate gl_fragment_program
Timothy Arceri [Wed, 19 Oct 2016 02:23:37 +0000 (13:23 +1100)]
st/mesa/r200/i915/i965: eliminate gl_fragment_program

Here we move OriginUpperLeft and PixelCenterInteger into gl_program
all other fields have been replace by shader_info.

V2: Don't use anonymous union/structs to hold vertex/fragment fields
suggested by Ian.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agoi965/mesa/st/swrast: set fs shader_info directly and switch to using it
Timothy Arceri [Wed, 19 Oct 2016 02:45:18 +0000 (13:45 +1100)]
i965/mesa/st/swrast: set fs shader_info directly and switch to using it

Note we access shader_info from the program struct rather than the
nir_shader pointer because shader cache won't create a nir_shader.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agomesa: remove now unused IsCentroid from gl_fragment_program
Timothy Arceri [Mon, 17 Oct 2016 23:51:43 +0000 (10:51 +1100)]
mesa: remove now unused IsCentroid from gl_fragment_program

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agost/mesa: get interpolation location at translation time
Timothy Arceri [Mon, 17 Oct 2016 23:47:14 +0000 (10:47 +1100)]
st/mesa: get interpolation location at translation time

Rather then messing around creating bitfields and arrays to store
the interpolation location just translate it on the fly.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agoi965: remove unused debug param
Timothy Arceri [Mon, 17 Oct 2016 02:43:55 +0000 (13:43 +1100)]
i965: remove unused debug param

This was accidently disabled in 832bcc3613 not long after it was added.

Since it's only for gen5 and lower we might as well just remove it rather
than fixing it.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agocompiler: update the comment for enum glsl_interp_mode
Timothy Arceri [Wed, 19 Oct 2016 02:27:01 +0000 (13:27 +1100)]
compiler: update the comment for enum glsl_interp_mode

We no longer store the interp mode with the program metadata.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agoglsl: remove now unused InterpQualifier
Timothy Arceri [Wed, 19 Oct 2016 22:55:11 +0000 (09:55 +1100)]
glsl: remove now unused InterpQualifier

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agoi965: remove unused BRW_STATE_INTERPOLATION_MAP flag
Timothy Arceri [Wed, 19 Oct 2016 23:00:02 +0000 (10:00 +1100)]
i965: remove unused BRW_STATE_INTERPOLATION_MAP flag

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agoi965: rewrite brw_setup_vue_interpolation()
Timothy Arceri [Wed, 19 Oct 2016 22:59:00 +0000 (09:59 +1100)]
i965: rewrite brw_setup_vue_interpolation()

Here brw_setup_vue_interpolation() is rewritten not to use the InterpQualifier
array in gl_fragment_program which will allow us to remove it.

This change also makes the code which is only used by gen4/5 more self contained
as it now has its own gen5_fragment_program struct rather than storing the map
in brw_context. This means the interpolation map will only get processed once
and will get stored in the in memory cache rather than being processed everytime
the fs changes.

Also by calling this from the fs compile code rather than from the upload code
and using the interpolation assigned there we can get rid of the
BRW_NEW_INTERPOLATION_MAP flag.

It might not seem ideal to add a gen5_fragment_program struct however by the end
of this series we will have gotten rid of all the brw_{shader_stage}_program
structs and replaced them with a generic brw_program struct so there will only
be two program structs which is better than what we have now.

V2: Don't remove BRW_NEW_INTERPOLATION_MAP from dirty_bit_map until the following
patch to fix build error.

V3 - Suggestions by Jason:
- name struct gen4_fragment_program rather than gen5_fragment_program
- don't use enum with memset()
- create interp mode set helper and simplify logic to call it
- add assert when calling function to show prog will never be NULL for
 gen4/5 i.e. no Vulkan

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agost/mesa: stop making use of InterpQualifier array
Timothy Arceri [Fri, 14 Oct 2016 09:06:56 +0000 (20:06 +1100)]
st/mesa: stop making use of InterpQualifier array

A following patch is going to merge the gl_fragment_program struct into
a common gl_program and we want to avoid all stages having this array.

V2: use TGSI_INTERPOLATE_COUNT as the temporary placeholder. Suggested by
Marek.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agomesa: remove unrequired code
Timothy Arceri [Fri, 14 Oct 2016 07:16:37 +0000 (18:16 +1100)]
mesa: remove unrequired code

InterpQualifier is never set for ARB programs so this will do nothing.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agoi965/mesa/st: eliminate gl_compute_program
Timothy Arceri [Wed, 19 Oct 2016 01:11:06 +0000 (12:11 +1100)]
i965/mesa/st: eliminate gl_compute_program

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agomesa: set cs shader_info metadata directly
Timothy Arceri [Wed, 19 Oct 2016 01:09:09 +0000 (12:09 +1100)]
mesa: set cs shader_info metadata directly

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agost/mesa: switch cs over to shared shader_info
Timothy Arceri [Wed, 19 Oct 2016 01:06:56 +0000 (12:06 +1100)]
st/mesa: switch cs over to shared shader_info

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agocompiler: add additional cs metadata fields to shader info
Timothy Arceri [Thu, 13 Oct 2016 04:18:53 +0000 (15:18 +1100)]
compiler: add additional cs metadata fields to shader info

And copy values from GLSL.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agomesa/i965/i915/r200: eliminate gl_vertex_program
Timothy Arceri [Wed, 19 Oct 2016 01:30:09 +0000 (12:30 +1100)]
mesa/i965/i915/r200: eliminate gl_vertex_program

Here we move the only field in gl_vertex_program to the
ARB program fields in gl_program.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agoi965: switch vs over to shared shader_info
Timothy Arceri [Wed, 19 Oct 2016 01:28:14 +0000 (12:28 +1100)]
i965: switch vs over to shared shader_info

Note we access shader_info from the program struct rather than the
nir_shader pointer because shader cache won't create a nir_shader.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agoi965/mesa/st: eliminate gl_geometry_program
Timothy Arceri [Wed, 19 Oct 2016 00:59:12 +0000 (11:59 +1100)]
i965/mesa/st: eliminate gl_geometry_program

We now get all the gs metadata from shader_info.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agomesa: set gs shader_info metadata directly
Timothy Arceri [Wed, 19 Oct 2016 00:53:33 +0000 (11:53 +1100)]
mesa: set gs shader_info metadata directly

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agost/mesa: switch gs over to shared shader_info
Timothy Arceri [Wed, 19 Oct 2016 00:51:11 +0000 (11:51 +1100)]
st/mesa: switch gs over to shared shader_info

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agoi965: switch gs over to shared shader_info
Timothy Arceri [Wed, 19 Oct 2016 00:48:02 +0000 (11:48 +1100)]
i965: switch gs over to shared shader_info

Note we access shader_info from the program struct rather than the
nir_shader pointer because shader cache won't create a nir_shader.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agocompiler: add input primative field for gs in shader info
Timothy Arceri [Thu, 13 Oct 2016 04:16:49 +0000 (15:16 +1100)]
compiler: add input primative field for gs in shader info

And copy the value from GLSL.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agoi965/mesa/st: eliminate gl_tess_eval_program
Timothy Arceri [Tue, 18 Oct 2016 23:30:52 +0000 (10:30 +1100)]
i965/mesa/st: eliminate gl_tess_eval_program

We now get all the tes metadata from shader_info.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agomesa: copy tes metadata directly to shared shader info
Timothy Arceri [Tue, 18 Oct 2016 23:29:56 +0000 (10:29 +1100)]
mesa: copy tes metadata directly to shared shader info

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agost/mesa: switch tes over to shared shader_info
Timothy Arceri [Tue, 18 Oct 2016 23:27:31 +0000 (10:27 +1100)]
st/mesa: switch tes over to shared shader_info

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agoi965: switch tes over to shared shader_info
Timothy Arceri [Tue, 18 Oct 2016 23:19:27 +0000 (10:19 +1100)]
i965: switch tes over to shared shader_info

Note we access shader_info from the program struct rather than the
nir_shader pointer because shader cache won't create a nir_shader.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agocompiler: add fields for tes metadata to shader info
Timothy Arceri [Thu, 13 Oct 2016 04:11:47 +0000 (15:11 +1100)]
compiler: add fields for tes metadata to shader info

And copy the values from gl_tess_eval_program struct.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agoi965/mesa/st: eliminate gl_tess_ctrl_program
Timothy Arceri [Wed, 19 Oct 2016 00:13:52 +0000 (11:13 +1100)]
i965/mesa/st: eliminate gl_tess_ctrl_program

We now get all the tcs metadata from shader_info.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agomesa: set tcs shader_info metadata directly
Timothy Arceri [Wed, 19 Oct 2016 00:11:28 +0000 (11:11 +1100)]
mesa: set tcs shader_info metadata directly

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agost/mesa: switch tcs over to shared shader_info
Timothy Arceri [Wed, 19 Oct 2016 00:13:26 +0000 (11:13 +1100)]
st/mesa: switch tcs over to shared shader_info

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agoi965: switch tcs over to shared shader_info
Timothy Arceri [Wed, 19 Oct 2016 00:08:18 +0000 (11:08 +1100)]
i965: switch tcs over to shared shader_info

Note we access shader_info from the program struct rather than the
nir_shader pointer because shader cache won't create a nir_shader.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agoglsl: add temporary copy_shader_info() function
Timothy Arceri [Tue, 18 Oct 2016 22:15:57 +0000 (09:15 +1100)]
glsl: add temporary copy_shader_info() function

This function is added here to ease refactoring towards using the new shared
shader_info. Once refactoring is complete and values are set directly it
will be removed.

We call it from _mesa_copy_linked_program_data() rather than glsl_to_nir()
so that the values will be set for all drivers. In order to do this some
calls need to be moved around so that we make sure to call
do_set_program_inouts() before _mesa_copy_linked_program_data()

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agoglsl: add a shader info field to the gl_program type
Timothy Arceri [Thu, 13 Oct 2016 04:20:38 +0000 (15:20 +1100)]
glsl: add a shader info field to the gl_program type

And use this field as the source for shader info in the nir_shader
this will allow us to set some of these fields from GLSL directly.

It will also simplify restoring from shader cache and allow the
removal of duplicate fields from GLSL.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agonir/i965/anv/radv/gallium: make shader info a pointer
Timothy Arceri [Thu, 13 Oct 2016 00:41:23 +0000 (11:41 +1100)]
nir/i965/anv/radv/gallium: make shader info a pointer

When restoring something from shader cache we won't have and don't
want to create a nir_shader this change detaches the two.

There are other advantages such as being able to reuse the
shader info populated by GLSL IR.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agonir: move nir_shader_info to a common compiler header
Timothy Arceri [Wed, 12 Oct 2016 23:46:11 +0000 (10:46 +1100)]
nir: move nir_shader_info to a common compiler header

This will allow use to stop copying values between structs and
will also simplify handling handling these values in the shader cache.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agomesa: modify _mesa_copy_linked_program_data() to take gl_linked_shader
Timothy Arceri [Wed, 19 Oct 2016 03:49:48 +0000 (14:49 +1100)]
mesa: modify _mesa_copy_linked_program_data() to take gl_linked_shader

This allows us to do some small tidy ups, but will also allow us to call
a new function that copies values to a shared shader info from here.

In order to make this change this function now requires
_mesa_reference_program() to have previously been called.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agovulkan/wsi/wayland: fix ARGB window support
Fredrik Höglund [Fri, 21 Oct 2016 17:07:37 +0000 (19:07 +0200)]
vulkan/wsi/wayland: fix ARGB window support

Use an ARGB format for the DRM buffer when the compositeAlpha field
in VkSwapchainCreateInfoKHR is set to
VK_COMPOSITE_ALPHA_PRE_MULTIPLIED_BIT_KHR.

Cc: "13.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agovulkan/wsi/x11: fix ARGB window support
Fredrik Höglund [Fri, 21 Oct 2016 17:07:36 +0000 (19:07 +0200)]
vulkan/wsi/x11: fix ARGB window support

Pass the correct depth to xcb_dri3_pixmap_from_buffer_checked().
Otherwise xcb_present_pixmap() fails with a BadMatch error.

Cc: "13.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agoradv: mark the fence as submitted and signalled in vkAcquireNextImageKHR
Fredrik Höglund [Tue, 25 Oct 2016 18:31:41 +0000 (20:31 +0200)]
radv: mark the fence as submitted and signalled in vkAcquireNextImageKHR

This stops the debug layers from complaining when fences are used to
throttle image acquisition.

Cc: "13.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agoscons: Require libdrm >= 2.4.66 for DRM.
Vinson Lee [Mon, 24 Oct 2016 23:33:01 +0000 (16:33 -0700)]
scons: Require libdrm >= 2.4.66 for DRM.

configure.ac already requires 2.4.66.

Fix SCons build. drmDevicePtr is not available until libdrm 2.4.65.

  Compiling src/loader/loader.c ...
src/loader/loader.c:111:40: error: unknown type name ‘drmDevicePtr’
 static char *drm_construct_id_path_tag(drmDevicePtr device)
                                        ^

Fixes: 4a183f4d06f8 ("scons: loader: use libdrm when available")
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98421
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Vedran Miletić <vedran@miletic.net>