mesa.git
7 years agoi965: Make ERROR_IF usable from other functions.
Matt Turner [Mon, 7 Nov 2016 05:08:24 +0000 (21:08 -0800)]
i965: Make ERROR_IF usable from other functions.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: Mark error annotation on correct SIMD16 inst.
Matt Turner [Sun, 20 Nov 2016 03:20:02 +0000 (19:20 -0800)]
i965: Mark error annotation on correct SIMD16 inst.

inst, whose assignment can be seen in the last line of context pointed
to the correct instruction in the SIMD16 program, but src_offset was the
offset from the beginning of the SIMD16 program.

So if an instruction at offset 0x100 in the SIMD16 program was illegal,
we would mark an error on the instruction at offset 0x100 (which is
likely in the SIMD8 program).

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965/vec4: Use UW-typed operands when dest is UW.
Matt Turner [Sun, 20 Nov 2016 04:04:34 +0000 (20:04 -0800)]
i965/vec4: Use UW-typed operands when dest is UW.

Using a UD-typed operand makes the execution size D, and if the size of
the execution type is greater than the size of the destination type, the
destination must be appropriately strided.

We actually just want UW-types all around.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: Use W-typed immediate in brw_F32TO16().
Matt Turner [Sun, 20 Nov 2016 08:10:54 +0000 (00:10 -0800)]
i965: Use W-typed immediate in brw_F32TO16().

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agogtest: Update to 1.8.0.
Matt Turner [Sat, 5 Nov 2016 05:20:10 +0000 (22:20 -0700)]
gtest: Update to 1.8.0.

Acked-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: Don't change F->VF if dest type is DF.
Matt Turner [Wed, 21 Dec 2016 16:12:39 +0000 (11:12 -0500)]
i965: Don't change F->VF if dest type is DF.

We change the immediate source type to VF to allow instruction
compaction, but there are no entires in the compaction table for DF, so
there's no point in doing this.

Additionally, I mixing floating-point types is now allowed except for
F and VF.

7 years agoanv: fix comment typo
Lionel Landwerlin [Mon, 16 Jan 2017 16:05:07 +0000 (16:05 +0000)]
anv: fix comment typo

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
7 years agospirv: fix warn string typo
Lionel Landwerlin [Fri, 13 Jan 2017 16:07:49 +0000 (16:07 +0000)]
spirv: fix warn string typo

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
7 years agoblorp: remove unnecessary struct declaration
Lionel Landwerlin [Fri, 20 Jan 2017 10:58:46 +0000 (10:58 +0000)]
blorp: remove unnecessary struct declaration

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
7 years agoRevert "radeonsi: reject invalid vertex element formats"
Marek Olšák [Fri, 20 Jan 2017 15:00:45 +0000 (16:00 +0100)]
Revert "radeonsi: reject invalid vertex element formats"

This reverts commit 9e4d1d8a7c0d60a6975d186944cd870e06f94773.

It broke arb_vertex_type_10f_11f_11f_rev-draw-vertices, which has
first_non_void == -1.

7 years agogallium: add pipe_screen::resource_changed callback wrappers
Philipp Zabel [Thu, 19 Jan 2017 14:05:42 +0000 (15:05 +0100)]
gallium: add pipe_screen::resource_changed callback wrappers

Add resource_changed to the ddebug, rbug, and trace wrappers. Since it
is optional, there is no need to add it to noop.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Suggested-by: Nicolai Hähnle <nhaehnle@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
7 years agost/mesa: ask pipe driver to recreate derived internal resources when (re-)binding...
Philipp Zabel [Thu, 19 Jan 2017 14:05:41 +0000 (15:05 +0100)]
st/mesa: ask pipe driver to recreate derived internal resources when (re-)binding external textures

Use the resource_changed callback to invalidate internal resources
derived from external textures when they are (re-)bound. This is needed
to comply with the requirement from the GL_OES_EGL_image_external
extension that a call to glBindTexture guarantees that all further
sampling will return values that correspond to the values in the
external texture at or after the time that glBindTexture was called.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
7 years agomesa: update external textures when (re-)binding
Philipp Zabel [Thu, 19 Jan 2017 14:05:40 +0000 (15:05 +0100)]
mesa: update external textures when (re-)binding

To comply with the requirement from the GL_OES_EGL_image_external
extension that a call to glBindTexture guarantees that all further
sampling will return values that correspond to the values in the
external texture at or after the time that glBindTexture was called,
do not bail out early from mesa_BindTextures if the target is
external.
This will later allow the state tracker to instruct the pipe driver
to invalidate internal resources derived from the external texture.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
7 years agoetnaviv: implement resource_changed to invalidate internal resources derived from...
Philipp Zabel [Thu, 19 Jan 2017 14:05:39 +0000 (15:05 +0100)]
etnaviv: implement resource_changed to invalidate internal resources derived from imported buffers

Implement the resource_changed pipe callback to invalidate internal
resources derived from imported buffers. This is needed to update the
texture for re-imported renderables.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Reviewed-by: Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
7 years agoetnaviv: initialize seqno of imported resources
Philipp Zabel [Thu, 19 Jan 2017 14:05:38 +0000 (15:05 +0100)]
etnaviv: initialize seqno of imported resources

Imported resources already have contents that we want to be copied to
texture resources derived from them. Set initial seqno of imported
resources to 1, just as if it had already been rendered to.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
7 years agost/dri: ask the driver to update its internal copies on reimport
Philipp Zabel [Thu, 19 Jan 2017 14:05:37 +0000 (15:05 +0100)]
st/dri: ask the driver to update its internal copies on reimport

For imported buffers that can't be used directly as a source to the
texture samplers, the pipe driver might need to create an internal
copy, for example in a different tiling layout. When buffers are
reimported they may contain new image data, so the driver internal
copies need to be recreated.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
7 years agogallium: add pipe_screen::resource_changed
Philipp Zabel [Thu, 19 Jan 2017 14:05:36 +0000 (15:05 +0100)]
gallium: add pipe_screen::resource_changed

Add a hook to tell drivers that an imported resource may have changed
and they need to update their internal derived resources.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
7 years agoconfigure.ac: move require_dri_shared_libs_and_glapi() before its users
Emil Velikov [Thu, 19 Jan 2017 15:19:56 +0000 (15:19 +0000)]
configure.ac: move require_dri_shared_libs_and_glapi() before its users

Otherwise we'll get a lovely message as below:
"require_dri_shared_libs_and_glapi: command not found"

Cc: Steven Newbury <steve@snewbury.org.uk>
Reported-by: Steven Newbury <steve@snewbury.org.uk>
Fixes: da410e6afad "configure: explicitly require shared glapi for
enable-dri"
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Tested-by: Steven Newbury <steve@snewbury.org.uk>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agogallium/hud: add missing break in hud_cpufreq_graph_install()
Samuel Pitoiset [Fri, 20 Jan 2017 00:19:49 +0000 (01:19 +0100)]
gallium/hud: add missing break in hud_cpufreq_graph_install()

Fixes: e99b9395bef "gallium/hud: Add support for CPU frequency monitoring"
Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
7 years agoandroid: correct typo in build
Tapani Pälli [Thu, 19 Jan 2017 07:10:34 +0000 (09:10 +0200)]
android: correct typo in build

Fixes: 63c58dfc653c499aab5b8d0ea07f1dc1af88c856
Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agonir: add min/max optimisation
Elie TOURNIER [Wed, 18 Jan 2017 11:23:22 +0000 (11:23 +0000)]
nir: add min/max optimisation

Add the following optimisations:

min(x, -x) = -abs(x)
min(x, -abs(x)) = -abs(x)
min(x, abs(x)) = x
max(x, -abs(x)) = x
max(x, abs(x)) = abs(x)
max(x, -x) = abs(x)

shader-db:

total instructions in shared programs: 13067779 -> 13067775 (-0.00%)
instructions in affected programs: 249 -> 245 (-1.61%)
helped: 4
HURT: 0

total cycles in shared programs: 252054838 -> 252054806 (-0.00%)
cycles in affected programs: 504 -> 472 (-6.35%)
helped: 2
HURT: 0

Signed-off-by: Elie Tournier <tournier.elie@gmail.com>
Reviewed-by: Plamena Manolova <plamena.manolova@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
7 years agonir/algebraic: Only include nir_search_helpers once
Jason Ekstrand [Wed, 18 Jan 2017 17:21:07 +0000 (09:21 -0800)]
nir/algebraic: Only include nir_search_helpers once

We were including it once per value, so probably around 10k times.
Let's not cause the compiler any more work than we have to.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
7 years agoi965: Remove unnecessary mt->compressed checks
Anuj Phogat [Tue, 10 Jan 2017 22:04:19 +0000 (14:04 -0800)]
i965: Remove unnecessary mt->compressed checks

It's harmless to use ALIGN_NPOT() for uncompressed formats
because they have block width/height = 1.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
7 years agoi965: Fix indentation in brw_miptree_layout_2d()
Anuj Phogat [Tue, 10 Jan 2017 22:03:58 +0000 (14:03 -0800)]
i965: Fix indentation in brw_miptree_layout_2d()

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
7 years agoi965: Fix comment to include 3d textures
Anuj Phogat [Tue, 10 Jan 2017 22:01:00 +0000 (14:01 -0800)]
i965: Fix comment to include 3d textures

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
7 years agoi965: Delete pending CCS and HiZ ops in intel_miptree_make_shareable()
Chad Versace [Wed, 4 Jan 2017 20:33:56 +0000 (12:33 -0800)]
i965: Delete pending CCS and HiZ ops in intel_miptree_make_shareable()

Fixes crash in piglit
`egl_khr_gl_renderbuffer_image-clear-shared-image GL_DEPTH_COMPONENT24`
on Skylake.

The crash happened because blorp attempted to execute a pending hiz
clear after the hiz buffer was deleted. Deleting the pending hiz ops
when the hiz buffer gets deleted fixes the crash.

For good measure, this patch also deletes all pending CCS/MCS ops when
the CCS/MCS buffer gets deleted. I'm now aware of any bugs
caused by the dangling ops, but deleting them is clearly the right thing
to do.

Cc: Ben Widawsky <ben@bwidawsk.net>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99265

7 years agovulkan/wsi: clarify the severity of lack of DRI3 v2
Andres Rodriguez [Wed, 18 Jan 2017 23:07:56 +0000 (18:07 -0500)]
vulkan/wsi: clarify the severity of lack of DRI3 v2

The current message sounds like a small warning, clarify that it can
result in lack of presentation support and application crashes.

v2: add "if they do" (Bas)

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98263
Signed-off-by: Andres Rodriguez <andresx7@gmail.com>
Acked-by: Jason ekstrand <jason@jlekstrand.net>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoradv: fix include order for installed headers v2
Andres Rodriguez [Wed, 18 Jan 2017 22:48:36 +0000 (17:48 -0500)]
radv: fix include order for installed headers v2

In situations where libdrm_amdgpu and mesa are installed to the same
location, the mesa installed headers will take precedence over the git
source headers.

This is due to the AMDGPU_CFLAGS containing the install directory.

This situation can cause build errors if the git version of a header is
newer than the currently installed version of a header (e.g. git pull
updates vulkan.h)

Note: using the same install prefix for mesa and libdrm is probably a
common occurrence since it is described in the radeonBuildHowTo wiki:
https://www.x.org/wiki/radeonBuildHowTo/

v2: added sign-off

Signed-off-by: Andres Rodriguez <andresx7@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agodocs/releasing: document post branch version bump
Emil Velikov [Thu, 19 Jan 2017 15:35:38 +0000 (15:35 +0000)]
docs/releasing: document post branch version bump

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
7 years agomesa: Bump version to 17.1.0-devel
Emil Velikov [Thu, 19 Jan 2017 15:33:29 +0000 (15:33 +0000)]
mesa: Bump version to 17.1.0-devel

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoradeonsi: reject invalid vertex element formats
Marek Olšák [Wed, 18 Jan 2017 21:35:19 +0000 (22:35 +0100)]
radeonsi: reject invalid vertex element formats

This should fix a coverity defect.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
7 years agoradeonsi: don't forget to add HTILE to the buffer list for texturing
Marek Olšák [Wed, 18 Jan 2017 21:15:35 +0000 (22:15 +0100)]
radeonsi: don't forget to add HTILE to the buffer list for texturing

This fixes VM faults. Discovered by Samuel Pitoiset.

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

Cc: 17.0 13.0 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
7 years agost/vdpau: only send buffers with B8G8R8A8 format to X
Nayan Deshmukh [Thu, 19 Jan 2017 09:29:28 +0000 (14:59 +0530)]
st/vdpau: only send buffers with B8G8R8A8 format to X

PresentPixmap only works if the pixmap depth matches with the
window depth, otherwise it returns a BadMatch protocol error.
Even if the depths match, the result won't look correctly
if the VDPAU RGB component order doesn't match the X11 one so
we only allow the X11 format.
For other buffers we copy them to a buffer which is send to X.

v2: only send buffers with format VDP_RGBA_FORMAT_B8G8R8A8
v3: reword commit message
v4: add comment explaining the code

Signed-off-by: Nayan Deshmukh <nayan26deshmukh@gmail.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
7 years agoradeonsi: fix texture gather on stencil textures
Nicolai Hähnle [Wed, 18 Jan 2017 08:28:47 +0000 (09:28 +0100)]
radeonsi: fix texture gather on stencil textures

At least on VI, texture gather doesn't work with a 24_8 data format, so
use 8_8_8_8 and a modified swizzle instead.

A bit of background: When creating a GL_STENCIL_INDEX8 texture, we select
the X24S8 pipe format because we don't support stencil-only render targets
properly. With mip-mapping this can lead to a setup where the tiling is
incompatible with stencil texturing, and a flushed stencil texture is
used. For the flushed stencil, a literal X24S8 is used because there were
issues with an 8bpp DB->CB copy.

Longer term, it would be good if we could get away from these workarounds,
i.e. properly support an S8 format for stencil-only rendering and flushed
stencil. Since stencil texturing is somewhat rare, it's not a high
priority.

Fixes GL45-CTS.texture_cube_map_array.sampling.

Cc: 17.0 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Acked-by: Edward O'Callaghan <funfunctor@folklore1984.net>
7 years agomesa/main: Fix FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE for NONE attachment type
Alejandro Piñeiro [Fri, 13 Jan 2017 13:39:24 +0000 (11:39 -0200)]
mesa/main: Fix FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE for NONE attachment type

When the attachment type is NONE (att->Type),
FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE should be NONE always.

Note that technically, the current behaviour follows the spec. From
OpenGL 4.5 spec, Section 9.2.3 "Framebuffer Object Queries":

   "If the value of FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE is NONE, then
    either no framebuffer is bound to target; or the default
    framebuffer is bound, attachment is DEPTH or STENCIL, and the
    number of depth or stencil bits, respectively, is zero."

Reading literally this paragraph, for the default framebuffer, NONE
should be only returned if attachment is DEPTH and STENCIL without
being allocated.

But it doesn't makes too much sense to return DEFAULT_FRAMEBUFFER if
the attachment type is NONE. For example, this can happens if the
attachment is FRONT_RIGHT run on monoscopic mode, as that attachment
is only available on stereo mode.

With the current behaviour, defensive querying of the object type
would not work properly. So you could query the object type checking
for NONE, get DEFAULT_FRAMEBUFFER, and then get and INVALID_OPERATION
when requesting other pnames (like RED_SIZE), as the real attachment
type is NONE.

This fixes:
GL45-CTS.direct_state_access.framebuffers_get_attachment_parameters

v2: don't change the behaviour for att->Type != GL_NONE, as caused
    some ES CTS regressions
v3: simplify condition (Iago)

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
7 years agoradeonsi: Always leave poly_offset in a valid state
Zachary Michaels [Thu, 19 Jan 2017 09:50:16 +0000 (10:50 +0100)]
radeonsi: Always leave poly_offset in a valid state

This commit makes si_update_poly_offset set poly_offset to NULL if
uses_poly_offset is false. This way poly_offset either points into the
currently queued rasterizer, or it is NULL.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99451
Cc: "13.0 17.0" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agomesa/main: fix meta caller of _mesa_ClampColor
Nicolai Hähnle [Mon, 16 Jan 2017 11:13:50 +0000 (12:13 +0100)]
mesa/main: fix meta caller of _mesa_ClampColor

Since _mesa_ClampColor properly checks for support of the API function
now, it's meta callers need to check support as well.

Fixes: 963311b71f ("mesa/main: fix version/extension checks in _mesa_ClampColor")
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99401
Tested-by: Mark Janes <mark.a.janes@intel.com>
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Cc: "17.0" <mesa-stable@lists.freedesktop.org>
7 years agomesa/glsl: move TransformFeedbackBufferStride to gl_shader
Timothy Arceri [Tue, 22 Nov 2016 09:24:33 +0000 (20:24 +1100)]
mesa/glsl: move TransformFeedbackBufferStride to gl_shader

Here we remove the single use of this field in gl_linked_shader
which allows us to move the field out of gl_shader_info

While we are at it we rewrite link_xfb_stride_layout_qualifiers()
to be more clear.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
7 years agoglsl: exit loop early if we find xfb layout qualifers
Timothy Arceri [Tue, 22 Nov 2016 08:55:29 +0000 (19:55 +1100)]
glsl: exit loop early if we find xfb layout qualifers

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
7 years agoglsl: set InnerCoverage directly in gl_program
Timothy Arceri [Mon, 19 Dec 2016 22:44:20 +0000 (09:44 +1100)]
glsl: set InnerCoverage directly in gl_program

Also move out of the shared gl_shader_info.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
7 years agoglsl: tidy up PostDepthCoverage shader field
Timothy Arceri [Mon, 19 Dec 2016 22:39:00 +0000 (09:39 +1100)]
glsl: tidy up PostDepthCoverage shader field

There is no reason for this to be in the shared gl_shader_info or
to copy it to gl_program at the end of linking (its already there).

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
7 years agomesa/glsl: move pixel_center_integer to gl_shader
Timothy Arceri [Tue, 22 Nov 2016 08:47:48 +0000 (19:47 +1100)]
mesa/glsl: move pixel_center_integer to gl_shader

This is only used by gl_linked_shader as a temp during linking
so use a temp there instead.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
7 years agomesa/glsl: move origin_upper_left to gl_shader
Timothy Arceri [Tue, 22 Nov 2016 07:50:03 +0000 (18:50 +1100)]
mesa/glsl: move origin_upper_left to gl_shader

This is only used by gl_linked_shader as a temp during linking
so use a temp there instead.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
7 years agomesa/glsl: move uses_gl_fragcoord to gl_shader
Timothy Arceri [Tue, 22 Nov 2016 07:37:06 +0000 (18:37 +1100)]
mesa/glsl: move uses_gl_fragcoord to gl_shader

This is only used by gl_linked_shader as a temp during linking
so use a temp there instead.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
7 years agomesa/glsl: move redeclares_gl_fragcoord to gl_shader
Timothy Arceri [Tue, 22 Nov 2016 07:25:20 +0000 (18:25 +1100)]
mesa/glsl: move redeclares_gl_fragcoord to gl_shader

This is never used in gl_linked_shader other than as a temp
during linking so just use a temp instead.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
7 years agomesa/glsl: move ARB_fragment_coord_conventions_enable field
Timothy Arceri [Tue, 22 Nov 2016 07:17:37 +0000 (18:17 +1100)]
mesa/glsl: move ARB_fragment_coord_conventions_enable field

This is only used by gl_shader not gl_linked_shader so move it
there.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
7 years agost/mesa/glsl: set early_fragment_tests directly in shader_info
Timothy Arceri [Tue, 22 Nov 2016 02:10:18 +0000 (13:10 +1100)]
st/mesa/glsl: set early_fragment_tests directly in shader_info

We also move EarlyFragmentTests out of the gl_shader_info struct
as it is now only used by gl_shader.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
7 years agomesa/glsl/i965: set and use tcs vertices_out directly
Timothy Arceri [Tue, 22 Nov 2016 02:10:18 +0000 (13:10 +1100)]
mesa/glsl/i965: set and use tcs vertices_out directly

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
7 years agoi965: get outputs_written from gl_program
Timothy Arceri [Fri, 18 Nov 2016 05:46:27 +0000 (16:46 +1100)]
i965: get outputs_written from gl_program

There is no need to go via the pointer in nir_shader. This change
is required for the shader cache as we don't create a nir_shader.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
7 years agogallivm: use #ifdef not #if for PIPE_ARCH_BIG_ENDIAN
Dave Airlie [Thu, 19 Jan 2017 04:39:10 +0000 (14:39 +1000)]
gallivm: use #ifdef not #if for PIPE_ARCH_BIG_ENDIAN

This fixes the build on ppc/s390.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Cc: "17.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agomesa: don't always set _NEW_PROGRAM when linking
Timothy Arceri [Mon, 9 Jan 2017 05:13:27 +0000 (16:13 +1100)]
mesa: don't always set _NEW_PROGRAM when linking

We only need to set it when linking was successful and the program
being linked is currently active.

The programs_in_use mask is just used as a flag for now but in
a future change we will use it to update the CurrentProgram array.

V2: make sure to flush vertices before linking (suggested by Marek)

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agomesa: change init subroutine defaults helper to work per gl_program
Timothy Arceri [Mon, 9 Jan 2017 05:13:28 +0000 (16:13 +1100)]
mesa: change init subroutine defaults helper to work per gl_program

A later patch will result in SSO programs calling this helper
per gl_program rather than per gl_shader_program.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
7 years agomesa/glsl: move ProgramResourceList to gl_shader_program_data
Timothy Arceri [Thu, 10 Nov 2016 08:46:11 +0000 (19:46 +1100)]
mesa/glsl: move ProgramResourceList to gl_shader_program_data

We also move NumProgramResourceList at the same time.

GLES does interface validation on SSO at runtime so we need to move
this to be able to switch to storing gl_program pointers in
CurrentProgram.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
7 years agoglsl: store number of explicit uniform loactions in gl_shader_program
Timothy Arceri [Sun, 4 Dec 2016 11:47:17 +0000 (22:47 +1100)]
glsl: store number of explicit uniform loactions in gl_shader_program

This allows us to cleanup the functions that pass this count around,
but more importantly we will be able to call the uniform linking
functions from that backends linker without having to pass this
information to the backend directly via Driver.LinkShader().

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoglsl: create a new link_and_validate_uniforms() helper
Timothy Arceri [Sun, 4 Dec 2016 10:42:14 +0000 (21:42 +1100)]
glsl: create a new link_and_validate_uniforms() helper

Currently this just breaks up the linking code a bit but in the
future i965 will call this from the backend via Driver.LinkShader()
so that we can do NIR optimisations before assigning uniform
locations.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoglsl: make a bunch of varying linking functions static
Timothy Arceri [Sun, 4 Dec 2016 10:28:41 +0000 (21:28 +1100)]
glsl: make a bunch of varying linking functions static

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoglsl: move more varying linking code to link_varyings.cpp
Timothy Arceri [Sun, 4 Dec 2016 10:11:13 +0000 (21:11 +1100)]
glsl: move more varying linking code to link_varyings.cpp

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965/blorp: Make post draw flush more explicit
Topi Pohjolainen [Tue, 17 Jan 2017 10:00:37 +0000 (12:00 +0200)]
i965/blorp: Make post draw flush more explicit

Blits do not need any special treatment as the target buffer
object is added to render cache just as one does for normal draw.
Color clears and resolves in turn require explicit "end of pipe
synchronization". It is not clear what this means exactly but the
assumption is that render cache flush with command stream stall
should be sufficient.

Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
7 years agoi965/gen6: Issue direct depth stall and flush after depth clear
Topi Pohjolainen [Tue, 17 Jan 2017 09:48:49 +0000 (11:48 +0200)]
i965/gen6: Issue direct depth stall and flush after depth clear

instead of calling unconditionally brw_emit_mi_flush() which
does:

   brw_emit_pipe_control_flush(brw,
                                PIPE_CONTROL_DEPTH_CACHE_FLUSH |
                                PIPE_CONTROL_RENDER_TARGET_FLUSH |
                                PIPE_CONTROL_CS_STALL);

   brw_emit_pipe_control_flush(brw,
                                PIPE_CONTROL_TEXTURE_CACHE_INVALIDATE |
                                PIPE_CONTROL_CONST_CACHE_INVALIDATE);

Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
7 years agoi965: Make depth clear flushing more explicit
Topi Pohjolainen [Tue, 17 Jan 2017 09:44:52 +0000 (11:44 +0200)]
i965: Make depth clear flushing more explicit

Current blorp logic issues unconditional "flush everything"
(see brw_emit_mi_flush()) after each render. For example, all
blits issue this unconditionally which shouldn't be needed if
they set render cache properly so that subsequent renders do
necessary flushing before drawing.

In case of piglit:

ext_framebuffer_multisample-accuracy all_samples depth_draw small

intel_hiz_exec() is always preceded by blorb blit and the
unconditional flush looks to hide the lack of stall and flushes
in depth clears. By removing the brw_emit_mi_flush() I get gpu
hangs.

This patch adds the stalls and flushes mandated by the spec
and gets rid of those hangs.

v2 (Jason, Ken): Document the rational for separating
                 depth cache flush and stall on Gen7.

Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
7 years agoi965/blorp: Use the render cache mechanism instead of explicit flushing
Topi Pohjolainen [Tue, 17 Jan 2017 09:04:22 +0000 (11:04 +0200)]
i965/blorp: Use the render cache mechanism instead of explicit flushing

by replacing brw_emit_mi_flush() with brw_render_cache_set_check_flush().
The latter splits the flush in two:

   brw_emit_pipe_control_flush(brw,
                               PIPE_CONTROL_DEPTH_CACHE_FLUSH |
                               PIPE_CONTROL_RENDER_TARGET_FLUSH |
                               PIPE_CONTROL_CS_STALL);

   brw_emit_pipe_control_flush(brw,
                               PIPE_CONTROL_TEXTURE_CACHE_INVALIDATE |
                               PIPE_CONTROL_CONST_CACHE_INVALIDATE);

instead of

   int flags = PIPE_CONTROL_NO_WRITE | PIPE_CONTROL_RENDER_TARGET_FLUSH;
   if (brw->gen >= 6) {
      flags |= PIPE_CONTROL_INSTRUCTION_INVALIDATE |
               PIPE_CONTROL_CONST_CACHE_INVALIDATE |
               PIPE_CONTROL_DEPTH_CACHE_FLUSH |
               PIPE_CONTROL_VF_CACHE_INVALIDATE |
               PIPE_CONTROL_TEXTURE_CACHE_INVALIDATE |
               PIPE_CONTROL_CS_STALL;
   }
   brw_emit_pipe_control_flush(brw, flags);

v2 (Jason): Check that destination exists before trying to add to
            render cache. Depth clears and resolves don't have it.

Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
7 years agoutils: really remove the __END_DECLS macro
Emil Velikov [Wed, 18 Jan 2017 19:48:37 +0000 (19:48 +0000)]
utils: really remove the __END_DECLS macro

Fixes: d1efa09d342 "util: import sha1 implementation from OpenBSD"
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoutils: build sha1/disk cache only with Android/Autoconf
Emil Velikov [Wed, 18 Jan 2017 19:40:31 +0000 (19:40 +0000)]
utils: build sha1/disk cache only with Android/Autoconf

Earlier commit imported a SHA1 implementation and relaxed the SHA1 and
disk cache handling, broking the Windows builds.

Restrict things for now until we get to a proper fix.

Fixes: d1efa09d342 "util: import sha1 implementation from OpenBSD"
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoutil: import sha1 implementation from OpenBSD
Emil Velikov [Fri, 13 Jan 2017 16:51:31 +0000 (16:51 +0000)]
util: import sha1 implementation from OpenBSD

At the moment we support 5+ different implementations each with varying
amount of bugs - from thread safely problems [1], to outright broken
implementation(s) [2]

In order to accommodate these we have 150+ lines of configure script and
extra two configure toggles. Whist an actual implementation being
~200loc and our current compat wrapping ~250.

Let's not forget that different people use different code paths, thus
effectively makes it harder to test and debug since the default
implementation is automatically detected.

To minimise all these lovely experiences, import the "100% Public
Domain" OpenBSD sha1 implementation. Clearly document any changes needed
to get building correctly, since many/most of those can be upstreamed
making future syncs easier.

As an added bonus this will avoid all the 'fun' experiences trying to
integrate it with the Android and SCons builds.

v2: Manually expand __BEGIN_DECLS/__END_DECLS and document (Tapani).

Furthermore it seems that some games (or surrounding runtime) static
link against OpenSSL resulting in conflicts. For more information see
the discussion thread [3]

Bugzilla [1]: https://bugs.freedesktop.org/show_bug.cgi?id=94904
Bugzilla [2]: https://bugs.freedesktop.org/show_bug.cgi?id=97967
[3] https://lists.freedesktop.org/archives/mesa-dev/2017-January/140748.html
Cc: Mark Janes <mark.a.janes@intel.com>
Cc: Vinson Lee <vlee@freedesktop.org>
Cc: Tapani Pälli <tapani.palli@intel.com>
Cc: Jonathan Gray <jsg@jsg.id.au>
Tested-by: Jonathan Gray <jsg@jsg.id.au>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Acked-by: Tapani Pälli <tapani.palli@intel.com> (v1)
Acked-by: Jason Ekstrand <jason@jlekstrand.net> (v1)
7 years agoi965: Make brw_cache_item structure private to brw_program_cache.c.
Kenneth Graunke [Fri, 11 Nov 2016 22:52:36 +0000 (14:52 -0800)]
i965: Make brw_cache_item structure private to brw_program_cache.c.

struct brw_cache_item is an implementation detail of the program cache.
We don't need to make those internals available to the entire driver.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eduardo Lima Mitev <elima@igalia.com>
7 years agoradeonsi: determine in advance which VBOs should be added to the buffer list
Marek Olšák [Tue, 17 Jan 2017 21:03:23 +0000 (22:03 +0100)]
radeonsi: determine in advance which VBOs should be added to the buffer list

v2: now it should be correct

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi: use fewer pointer dereferences in upload_vertex_buffer_descriptors
Marek Olšák [Tue, 17 Jan 2017 20:55:59 +0000 (21:55 +0100)]
radeonsi: use fewer pointer dereferences in upload_vertex_buffer_descriptors

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi: reject invalid vertex buffer indices at state creation
Marek Olšák [Tue, 17 Jan 2017 20:49:50 +0000 (21:49 +0100)]
radeonsi: reject invalid vertex buffer indices at state creation

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi: use a global dirty mask for shader pointers
Marek Olšák [Tue, 17 Jan 2017 20:30:23 +0000 (21:30 +0100)]
radeonsi: use a global dirty mask for shader pointers

Only vertex buffers use a separate bool flag.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi: use a bitmask-based loop in si_decompress_textures
Marek Olšák [Tue, 17 Jan 2017 19:46:39 +0000 (20:46 +0100)]
radeonsi: use a bitmask-based loop in si_decompress_textures

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi: skip an unnecessary mutex lock for L2 prefetches
Marek Olšák [Tue, 17 Jan 2017 19:10:15 +0000 (20:10 +0100)]
radeonsi: skip an unnecessary mutex lock for L2 prefetches

the mutex lock is inside util_range_add.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi: si_cp_dma_prepare is a no-op for L2 prefetches
Marek Olšák [Tue, 17 Jan 2017 17:42:23 +0000 (18:42 +0100)]
radeonsi: si_cp_dma_prepare is a no-op for L2 prefetches

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi: add SI_CPDMA_SKIP_BO_LIST_UPDATE
Marek Olšák [Tue, 17 Jan 2017 17:40:26 +0000 (18:40 +0100)]
radeonsi: add SI_CPDMA_SKIP_BO_LIST_UPDATE

the next commit will use it in a clever way, because the CP DMA prefetch
doesn't need this.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi: use the correct target machine when building shader variants
Marek Olšák [Tue, 17 Jan 2017 17:04:13 +0000 (18:04 +0100)]
radeonsi: use the correct target machine when building shader variants

If the shader selector is created with a different context than
the shader variant, we should use the calling context's target machine
for the shader variant.

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

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi: move shader pipe context state into a separate structure
Marek Olšák [Tue, 17 Jan 2017 16:39:16 +0000 (17:39 +0100)]
radeonsi: move shader pipe context state into a separate structure

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoi965: Fix SURFACE_STATE to handle non-zero aux offsets
Ben Widawsky [Fri, 2 Dec 2016 19:10:47 +0000 (11:10 -0800)]
i965: Fix SURFACE_STATE to handle non-zero aux offsets

Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Acked-by: Daniel Stone <daniels@collabora.com>
7 years agoRevert "etnaviv: Fake occlusion query capability"
Christian Gmeiner [Wed, 18 Jan 2017 16:32:51 +0000 (17:32 +0100)]
Revert "etnaviv: Fake occlusion query capability"

This reverts commit b7ac0f567123c96b5cd9e3485b963a5c0a0db66a.

This is a half baked solution needs some rework to fixes issues
with reported counter bits (GL_QUERY_COUNTER_BITS_ARB).
Also it enables PIPE_CAP_QUERY_TIME_ELAPSED accidently.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
7 years agoandroid: ac/debug: move sid_tables.h generation and IB decode to amd/common
Mauro Rossi [Thu, 12 Jan 2017 00:14:12 +0000 (01:14 +0100)]
android: ac/debug: move sid_tables.h generation and IB decode to amd/common

This patch is the porting to android of the following commits:

b838f64 "ac/debug: Move sid_tables.h generation to common code."
0ef1b4d "ac/debug: Move IB decode to common code."

Fixes android building errors due to sid_tables.h
and ac_debug.c, ac_debug.h moved to amd/common

Tested by building nougat-x86

Acked-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Acked-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoandroid: gallium/auxiliary: fix building error in Android 7.0
Mauro Rossi [Tue, 10 Jan 2017 00:53:05 +0000 (01:53 +0100)]
android: gallium/auxiliary: fix building error in Android 7.0

Conditional libLLVMCore static library dependency is added,
for the case when MESA_ENABLE_LLVM is true

Fixes the following building error with Android 7.0:

In file included from
external/mesa/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp:62:
...
external/llvm/include/llvm/IR/Attributes.h:68:14: fatal error:
'llvm/IR/Attributes.inc' file not found
    #include "llvm/IR/Attributes.inc"
             ^
1 error generated.

Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoandroid: amd/common: fix LLVMInitializeAMDGPU* functions declaration
Mauro Rossi [Tue, 10 Jan 2017 00:53:02 +0000 (01:53 +0100)]
android: amd/common: fix LLVMInitializeAMDGPU* functions declaration

LLVMInitializeAMDGPU* functions need to be explicitly declared
and mesa expects them via <llvm-c/Target.h> header,
but LLVM needs to be instructed to invoke its own LLVM_TARGET(AMDGPU) macro,
or the functions will not be available.

A new llvm cflag (-DFORCE_BUILD_AMDGPU) serves this purpose,
the same mechanism is used also by other llvm targets e.g. FORCE_BUILD_ARM

A necessary prerequisite is to have AMDGPU target handled accordingly
in llvm config files i.e. {Target,AsmParser,AsmPrinter}.def
for llvm device build includes.

This avoids the following building errors:

external/mesa/src/amd/common/ac_llvm_util.c:43:2: error: implicit declaration of function 'LLVMInitializeAMDGPUTargetInfo' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
        LLVMInitializeAMDGPUTargetInfo();
        ^
external/mesa/src/amd/common/ac_llvm_util.c:44:2: error: implicit declaration of function 'LLVMInitializeAMDGPUTarget' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
        LLVMInitializeAMDGPUTarget();
        ^
external/mesa/src/amd/common/ac_llvm_util.c:45:2: error: implicit declaration of function 'LLVMInitializeAMDGPUTargetMC' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
        LLVMInitializeAMDGPUTargetMC();
        ^
external/mesa/src/amd/common/ac_llvm_util.c:46:2: error: implicit declaration of function 'LLVMInitializeAMDGPUAsmPrinter' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
        LLVMInitializeAMDGPUAsmPrinter();
        ^
Acked-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Acked-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoandroid: radeonsi: fix LLVMInitializeAMDGPU* functions declaration
Mauro Rossi [Tue, 10 Jan 2017 00:53:01 +0000 (01:53 +0100)]
android: radeonsi: fix LLVMInitializeAMDGPU* functions declaration

LLVMInitializeAMDGPU* functions need to be explicitly declared
and mesa expects them via <llvm-c/Target.h> header,
but LLVM needs to be instructed to invoke its own LLVM_TARGET(AMDGPU) macro,
or the functions will not be available.

A new llvm cflag (-DFORCE_BUILD_AMDGPU) serves this purpose,
the same mechanism is used also by other llvm targets e.g. FORCE_BUILD_ARM

A necessary prerequisite is to have AMDGPU target handled accordingly
in llvm config files i.e. {Target,AsmParser,AsmPrinter}.def
for llvm device build includes.

This avoids the following building errors:

external/mesa/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c:129:2: error: implicit declaration of function 'LLVMInitializeAMDGPUTargetInfo' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
        LLVMInitializeAMDGPUTargetInfo();
        ^
external/mesa/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c:130:2: error: implicit declaration of function 'LLVMInitializeAMDGPUTarget' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
        LLVMInitializeAMDGPUTarget();
        ^
external/mesa/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c:131:2: error: implicit declaration of function 'LLVMInitializeAMDGPUTargetMC' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
        LLVMInitializeAMDGPUTargetMC();
        ^
external/mesa/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c:132:2: error: implicit declaration of function 'LLVMInitializeAMDGPUAsmPrinter' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
        LLVMInitializeAMDGPUAsmPrinter();
        ^

Acked-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Acked-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoandroid: radeon: fix LLVMInitializeAMDGPU* functions declaration
Mauro Rossi [Tue, 10 Jan 2017 00:53:00 +0000 (01:53 +0100)]
android: radeon: fix LLVMInitializeAMDGPU* functions declaration

LLVMInitializeAMDGPU* functions need to be explicitly declared
and mesa expects them via <llvm-c/Target.h> header,
but LLVM needs to be instructed to invoke its own LLVM_TARGET(AMDGPU) macro,
or the functions will not be available.

A new llvm cflag (-DFORCE_BUILD_AMDGPU) serves this purpose,
the same mechanism is used also by other llvm targets e.g. FORCE_BUILD_ARM

A necessary prerequisite is to have AMDGPU target handled accordingly
in llvm config files i.e. {Target,AsmParser,AsmPrinter}.def
for llvm device build includes.

This avoids the following building errors:

external/mesa/src/gallium/drivers/radeon/radeon_llvm_emit.c:121:2: error: implicit declaration of function 'LLVMInitializeAMDGPUTargetInfo' [-Werror=implicit-function-declaration]
  LLVMInitializeAMDGPUTargetInfo();
  ^
external/mesa/src/gallium/drivers/radeon/radeon_llvm_emit.c:122:2: error: implicit declaration of function 'LLVMInitializeAMDGPUTarget' [-Werror=implicit-function-declaration]
  LLVMInitializeAMDGPUTarget();
  ^
external/mesa/src/gallium/drivers/radeon/radeon_llvm_emit.c:123:2: error: implicit declaration of function 'LLVMInitializeAMDGPUTargetMC' [-Werror=implicit-function-declaration]
  LLVMInitializeAMDGPUTargetMC();
  ^
external/mesa/src/gallium/drivers/radeon/radeon_llvm_emit.c:124:2: error: implicit declaration of function 'LLVMInitializeAMDGPUAsmPrinter' [-Werror=implicit-function-declaration]
  LLVMInitializeAMDGPUAsmPrinter();
  ^

Acked-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Acked-by: Emil Velikov <emil.velikov@collabora.com>
7 years agonouveau: remove always false argument in nouveau_fence_new()
Emil Velikov [Mon, 16 Jan 2017 16:25:19 +0000 (16:25 +0000)]
nouveau: remove always false argument in nouveau_fence_new()

No point in having the extra argument considering that it's effectively
unused since the function was introduced.

Cc: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
7 years agoegl/wayland: resolve quirky try_damage_buffer() implementation
Emil Velikov [Fri, 13 Jan 2017 17:27:56 +0000 (17:27 +0000)]
egl/wayland: resolve quirky try_damage_buffer() implementation

The implementation was added with commit d085a5dff5b and effectively
provided a hidden dependency.

Namely: the codepath used was determined solely during build time. Thus
if we built again new wayland and then run against older (yet still
within the requirements, as per the configure) one will get undefined
symbols.

As of earlier commit 36b9976e1f9 "egl/wayland: Avoid race conditions
when on non-main thread" the required version was bumped to one which
provides the API, thus we can drop the quirky solution.

Cc: Derek Foreman <derekf@osg.samsung.com>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
7 years agoconfigure: error out when building static XOR shared
Emil Velikov [Wed, 7 Dec 2016 13:25:01 +0000 (13:25 +0000)]
configure: error out when building static XOR shared

Current code warns out in such cases and falls-back to either static or
shared. That can be easily missed amongst the volume produced by our
configure script.

Replace the warning with an error such that one gets direct feedback
when they're doing something wrong.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoconfigure: explicitly require shared glapi for enable-dri
Emil Velikov [Wed, 7 Dec 2016 13:25:00 +0000 (13:25 +0000)]
configure: explicitly require shared glapi for enable-dri

We've been using and depending on it for at least a couple of years.
Make it obvious and error out, should one opt for it.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoconfigure: factor out commom egl/gbm checks
Emil Velikov [Wed, 7 Dec 2016 13:24:59 +0000 (13:24 +0000)]
configure: factor out commom egl/gbm checks

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoconfigure: remove HAVE_EGL_DRIVER_DRI[23]
Emil Velikov [Wed, 7 Dec 2016 13:24:58 +0000 (13:24 +0000)]
configure: remove HAVE_EGL_DRIVER_DRI[23]

We have them for local purposes in configure, where we can use their
direct dependency.

With the only remaining instance in the makefile(s) being always true,
as it can be seen in the configure snippet.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoconfigure: forbid static EGL/GBM
Emil Velikov [Wed, 7 Dec 2016 13:24:57 +0000 (13:24 +0000)]
configure: forbid static EGL/GBM

Both libraries implicitly require shared GLAPI which in itself mandates
shared libraries.

Stop pretending that one can use it and error out at configure stage.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoconfigure: remove unused AC_SUBST variables
Emil Velikov [Thu, 8 Dec 2016 17:58:22 +0000 (17:58 +0000)]
configure: remove unused AC_SUBST variables

v2: Rebase.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com> (v1)
7 years agogallium: correctly manage libsensors link flags
Emil Velikov [Thu, 8 Dec 2016 17:58:21 +0000 (17:58 +0000)]
gallium: correctly manage libsensors link flags

We should be using LIBS rather than the LDFLAGS variable. Furthermore
try to keep the linking to the final stage, rather than intermetent
static library.

Cc: Steven Toth <stoth@kernellabs.com>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoegl/wayland: unify dri2_wl_create_surface implementations
Emil Velikov [Mon, 28 Nov 2016 18:25:19 +0000 (18:25 +0000)]
egl/wayland: unify dri2_wl_create_surface implementations

Rather than having two almost identical codepaths (one for HW/wl_drm and
another for SW/wl_shm), just factorise and reuse in both places.

v2: Rebase
v3: Rebase

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com> (v2)
7 years agoegl/wayland: use the destroy_window_callback for swrast
Emil Velikov [Mon, 28 Nov 2016 18:25:18 +0000 (18:25 +0000)]
egl/wayland: use the destroy_window_callback for swrast

As described in commit 690ead4a135 ("egl/wayland-egl: Fix for segfault
in dri2_wl_destroy_surface.") if we attempt to destroy a EGL surface
attached to already destroyed Wayland window we'll get a segfault.

v2: set the correct callback alongside the window->private. (Dan)

Cc: Daniel Stone <daniels@collabora.com>
Cc: "12.0 13.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agoglx: unify GLX_SGIX_pbuffer aliased declarations
Emil Velikov [Mon, 5 Dec 2016 19:52:45 +0000 (19:52 +0000)]
glx: unify GLX_SGIX_pbuffer aliased declarations

No point in having an identical code in two places.

Not to mention that the Apple one incorrectly uses GLXDrawable as pbuf
type. This change is both API and ABI safe since the header uses the
correct GLXPbufferSGIX and both types are a typedef of the same
primitive XID.

Cc: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Jeremy Sequoia <jeremyhu@apple.com>
7 years agoglx: use GLX_ALIAS for glXGetProcAddress
Emil Velikov [Mon, 5 Dec 2016 19:52:44 +0000 (19:52 +0000)]
glx: use GLX_ALIAS for glXGetProcAddress

Use the macro, rather than open-coding it.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
7 years agomesa: make use of HAVE_FUNC_ATTRIBUTE_ALIAS macro
Emil Velikov [Mon, 5 Dec 2016 19:52:43 +0000 (19:52 +0000)]
mesa: make use of HAVE_FUNC_ATTRIBUTE_ALIAS macro

We must make sure that xserver has an equivalent one-line
change to its configure.ac as the glx/glapi headers get copied over.

Then again, xserver does _not_ seem to set HAVE_ALIAS to begin with so
one might want to look into that first.

Cc: Adam Jackson <ajax@redhat.com>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoandroid: set HAVE_FUNC_ATTRIBUTE_ALIAS
Emil Velikov [Mon, 5 Dec 2016 19:52:42 +0000 (19:52 +0000)]
android: set HAVE_FUNC_ATTRIBUTE_ALIAS

Analogous to previous two commits.

Strictly speaking it's not be applicable for Android since we don't
build GLX and related code.

Regardless keep things consistent with the other build systems.

Cc: Rob Herring <robh@kernel.org>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoscons: set HAVE_FUNC_ATTRIBUTE_ALIAS
Emil Velikov [Mon, 5 Dec 2016 19:52:41 +0000 (19:52 +0000)]
scons: set HAVE_FUNC_ATTRIBUTE_ALIAS

Analogoust to the previous commit were we did so for autotools

Cc: Jose Fonseca <jfonseca@vmware.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
7 years agoconfigure: use standard check for attribure alias
Emil Velikov [Mon, 5 Dec 2016 19:52:40 +0000 (19:52 +0000)]
configure: use standard check for attribure alias

Currently we have two macros - HAVE_ALIAS and GLX_ALIAS_UNSUPPORTED.
To make it even better former of which is explicitly cleared in some
cases while not in others.

Clear all that up by using a single macro properly set during configure.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoglx: remove always false ifdef GLX_NO_STATIC_EXTENSION_FUNCTIONS
Emil Velikov [Mon, 5 Dec 2016 19:52:39 +0000 (19:52 +0000)]
glx: remove always false ifdef GLX_NO_STATIC_EXTENSION_FUNCTIONS

Quick search through git history (of both mesa and xserver) hows no
instances where this was ever set.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>