mesa.git
6 years agogallium: Remove unused variable in u_tests.
Eric Anholt [Tue, 27 Nov 2018 19:25:09 +0000 (11:25 -0800)]
gallium: Remove unused variable in u_tests.

Fixes: 0d17b685b1ff ("gallium/u_tests: add a compute shader test that clears an image")
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
6 years agoradv: Align large buffers to the fragment size.
Bas Nieuwenhuizen [Mon, 26 Nov 2018 02:28:05 +0000 (03:28 +0100)]
radv: Align large buffers to the fragment size.

Improves performance in Talos by about 15% (and significant improvements
in RotR and possibly other but did not bench with final patch) on
kernel 4.19 and earlier.

On 4.20+ a similar effect comes from

433ca054949a "drm/amdgpu: try allocating VRAM as power of two"

v2: Do not impact the alignment of the physical memory.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
CC: <mesa-stable@lists.freedesktop.org>
6 years agofreedreno: implements get_sample_position
Hyunjun Ko [Wed, 7 Nov 2018 02:30:31 +0000 (11:30 +0900)]
freedreno: implements get_sample_position

Since 1285f71d3e landed, it needs to provide apps with proper sample
position for MSAA.

Currently no way to query this to hw, these are taken from blob driver.

Fixes: dEQP-GLES31.functional.texture.multisample.samples_#.sample_position
Signed-off-by: Rob Clark <robdclark@gmail.com>
6 years agofreedreno/a3xx: also set FSSUPERTHREADENABLE
Rob Clark [Fri, 23 Nov 2018 16:30:34 +0000 (11:30 -0500)]
freedreno/a3xx: also set FSSUPERTHREADENABLE

We set equiv bit in SP_FS_CTRL_REG0.  Somehow the hw doesn't hang with
this mismatched config, but does run slower.  It is faster with either
neither bit set, or both bits set, but both is the fastest of the three
configurations.  Worth a bit over 10% gain in glmark2.

Spotted-by: Jonathan Marek <jonathan@marek.ca>
Signed-off-by: Rob Clark <robdclark@gmail.com>
6 years agofreedreno: use MSM_BO_SCANOUT with scanout buffers
Jonathan Marek [Mon, 19 Nov 2018 21:02:15 +0000 (16:02 -0500)]
freedreno: use MSM_BO_SCANOUT with scanout buffers

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
6 years agofreedreno: use GENERIC instead of TEXCOORD for blit program
Jonathan Marek [Tue, 13 Nov 2018 16:42:33 +0000 (11:42 -0500)]
freedreno: use GENERIC instead of TEXCOORD for blit program

blip_fp uses GENERIC as input, so blit_vp should match for linking

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Signed-off-by: Rob Clark <robdclark@gmail.com>
6 years agofreedreno: a2xx texture update
Jonathan Marek [Tue, 13 Nov 2018 16:40:03 +0000 (11:40 -0500)]
freedreno: a2xx texture update

Adds all missing texture related logic. For everything to work it also
needs changes to ir2/fd2_program, which are part of the ir2 update patch.

Note: it needs rnndb update

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
[remove stray patch]
Signed-off-by: Rob Clark <robdclark@gmail.com>
6 years agofreedreno/a2xx: Compute depth base in gmem correctly
Jonathan Marek [Tue, 13 Nov 2018 16:30:31 +0000 (11:30 -0500)]
freedreno/a2xx: Compute depth base in gmem correctly

Note: it needs rnndb update

Signed-off-by: Marek Vasut <marex@denx.de>
Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Signed-off-by: Rob Clark <robdclark@gmail.com>
6 years agofreedreno/a2xx: set VIZ_QUERY_ID on a20x
Jonathan Marek [Tue, 13 Nov 2018 16:26:38 +0000 (11:26 -0500)]
freedreno/a2xx: set VIZ_QUERY_ID on a20x

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Signed-off-by: Rob Clark <robdclark@gmail.com>
6 years agofreedreno: add missing a20x ids
Jonathan Marek [Tue, 13 Nov 2018 16:19:39 +0000 (11:19 -0500)]
freedreno: add missing a20x ids

200: 256KiB GMEM A200 (imx53)
201: 128KiB GMEM A200 (imx51)

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Signed-off-by: Rob Clark <robdclark@gmail.com>
6 years agofreedreno/a2xx: fix POINT_MINMAX_MAX overflow
Jonathan Marek [Tue, 13 Nov 2018 16:17:48 +0000 (11:17 -0500)]
freedreno/a2xx: fix POINT_MINMAX_MAX overflow

As it stands, it overflows to zero.

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Signed-off-by: Rob Clark <robdclark@gmail.com>
6 years agofreedreno: a2xx: fd2_draw update
Jonathan Marek [Tue, 13 Nov 2018 16:04:32 +0000 (11:04 -0500)]
freedreno: a2xx: fd2_draw update

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Signed-off-by: Rob Clark <robdclark@gmail.com>
6 years agonir: add fceil lowering
Jonathan Marek [Mon, 12 Nov 2018 17:49:32 +0000 (12:49 -0500)]
nir: add fceil lowering

lowers ceil(x) as -floor(-x)

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Signed-off-by: Rob Clark <robdclark@gmail.com>
6 years agofreedreno: update generated headers
Rob Clark [Sun, 18 Nov 2018 15:02:47 +0000 (10:02 -0500)]
freedreno: update generated headers

Signed-off-by: Rob Clark <robdclark@gmail.com>
6 years agofreedreno/a6xx: set guardband clip
Rob Clark [Mon, 19 Nov 2018 15:24:40 +0000 (10:24 -0500)]
freedreno/a6xx: set guardband clip

On older gens, the CLIP_ADJ bitfields were actually 3.6 fixed point.
Which might make more sense.  Although this formula comes up with values
pretty close to what blob does for various viewport sizes (for at least
a5xx and a6xx), and seems to work.

Signed-off-by: Rob Clark <robdclark@gmail.com>
6 years agofreedreno/a6xx: disable LRZ for z32
Rob Clark [Tue, 13 Nov 2018 19:49:25 +0000 (14:49 -0500)]
freedreno/a6xx: disable LRZ for z32

f6131d4ec7a had the side effect of enabling LRZ w/ 32b depth buffers.
But there are some bugs with this, which aren't fully understood yet,
so for now just skip LRZ w/ z32..

Fixes: f6131d4ec7a freedreno/a6xx: Clear z32 and separate stencil with blitter
Signed-off-by: Rob Clark <robdclark@gmail.com>
6 years agofreedreno/a6xx: Clear gmem buffers at flush time
Kristian H. Kristensen [Fri, 19 Oct 2018 21:29:49 +0000 (14:29 -0700)]
freedreno/a6xx: Clear gmem buffers at flush time

We generate an IB to clear the gmem at flush time and jump to it
before rendering each tile. This lets us get rid of the command stream
patching for gmem offsets.

Signed-off-by: Kristian H. Kristensen <hoegsberg@chromium.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
6 years agofreedreno/a6xx: Move resolve blits to an IB
Kristian H. Kristensen [Wed, 24 Oct 2018 07:00:50 +0000 (00:00 -0700)]
freedreno/a6xx: Move resolve blits to an IB

Signed-off-by: Kristian H. Kristensen <hoegsberg@chromium.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
6 years agofreedreno/a6xx: Move restore blits to IB
Kristian H. Kristensen [Wed, 24 Oct 2018 06:50:34 +0000 (23:50 -0700)]
freedreno/a6xx: Move restore blits to IB

Signed-off-by: Kristian H. Kristensen <hoegsberg@chromium.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
6 years agomesa/st: better colormask check for clear fallback
Rob Clark [Tue, 13 Nov 2018 19:19:38 +0000 (14:19 -0500)]
mesa/st: better colormask check for clear fallback

For RGB surfaces (for example) we don't really care that the colormask
is 0x7 instead of 0xf.  This should not trigger clear_with_quad()
slowpath.

Signed-off-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
6 years agomesa/st: swap order of clear() and clear_with_quad()
Rob Clark [Tue, 13 Nov 2018 18:40:58 +0000 (13:40 -0500)]
mesa/st: swap order of clear() and clear_with_quad()

If we can't clear all the buffers with pctx->clear() (say, for example,
because of ColorMask), push the buffers we *can* clear with pctx->clear()
first.  Tilers want to see clears coming before draws to enable fast-
paths, and clearing one of the attachments with a quad-draw first
confuses that logic.

Signed-off-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
6 years agofreedreno: move ir3 to common location
Rob Clark [Sat, 10 Nov 2018 17:05:59 +0000 (12:05 -0500)]
freedreno: move ir3 to common location

Move (most of) the ir3 compiler to src/freedreno/ir3 so that it can be
re-used by some future vulkan driver.  The parts that are gallium
specific have been refactored out and remain in the gallium driver.

Getting the move done now so that it can happen before further
refactoring to support a6xx specific instructions.

NOTE also removes ir3_cmdline compiler tool from autotools build since
that was easier than fixing it and I normally use meson build.  Waiting
patiently for the day that we can remove *everything* from the autotools
build.

Signed-off-by: Rob Clark <robdclark@gmail.com>
6 years agofreedreno/ir3: remove u_inlines usage
Rob Clark [Sat, 10 Nov 2018 15:32:36 +0000 (10:32 -0500)]
freedreno/ir3: remove u_inlines usage

Signed-off-by: Rob Clark <robdclark@gmail.com>
6 years agofreedreno/ir3: split up ir3_shader
Rob Clark [Sat, 10 Nov 2018 15:11:18 +0000 (10:11 -0500)]
freedreno/ir3: split up ir3_shader

Split the parts that are gallium specific into ir3_gallium so the rest
can move to a common location outside of gallium.

Signed-off-by: Rob Clark <robdclark@gmail.com>
6 years agofreedreno/ir3: remove pipe_stream_output_info dependency
Rob Clark [Fri, 9 Nov 2018 19:46:28 +0000 (14:46 -0500)]
freedreno/ir3: remove pipe_stream_output_info dependency

A bit annoying to have to copy into our own struct.  But this is
something the compiler really needs to know, at least on earlier
generations where streamout is implemented in shader.

Signed-off-by: Rob Clark <robdclark@gmail.com>
6 years agofreedreno/ir3: some header file cleanup
Rob Clark [Fri, 9 Nov 2018 14:40:20 +0000 (09:40 -0500)]
freedreno/ir3: some header file cleanup

Clean up some of the low-hanging-fruit usages of freedreno_util.h

Signed-off-by: Rob Clark <robdclark@gmail.com>
6 years agofreedreno/ir3: use env_var_as_unsigned()
Rob Clark [Fri, 9 Nov 2018 18:49:55 +0000 (13:49 -0500)]
freedreno/ir3: use env_var_as_unsigned()

Signed-off-by: Rob Clark <robdclark@gmail.com>
6 years agoutil: env_var_as_unsigned() helper
Rob Clark [Fri, 9 Nov 2018 18:28:36 +0000 (13:28 -0500)]
util: env_var_as_unsigned() helper

So I can drop env2u() helper from freedreno_util.h and get rid of one
small ir3 dependency on gallium/freedreno

Signed-off-by: Rob Clark <robdclark@gmail.com>
6 years agofreedreno/ir3: move disasm and optmsgs debug flags
Rob Clark [Fri, 9 Nov 2018 16:08:16 +0000 (11:08 -0500)]
freedreno/ir3: move disasm and optmsgs debug flags

Move them to IR3_SHADER_DEBUG so we can remove ir3's dependency on
fd_mesa_debug.

Signed-off-by: Rob Clark <robdclark@gmail.com>
6 years agofreedreno: FD_SHADER_DEBUG -> IR3_SHADER_DEBUG
Rob Clark [Fri, 9 Nov 2018 15:57:18 +0000 (10:57 -0500)]
freedreno: FD_SHADER_DEBUG -> IR3_SHADER_DEBUG

Only used by ir3, so move it into ir3 to be more self contained.

Signed-off-by: Rob Clark <robdclark@gmail.com>
6 years agofreedreno: remove shader_stage_name()
Rob Clark [Fri, 9 Nov 2018 15:50:48 +0000 (10:50 -0500)]
freedreno: remove shader_stage_name()

Signed-off-by: Rob Clark <robdclark@gmail.com>
6 years agofreedreno: shader_t -> gl_shader_stage
Rob Clark [Fri, 9 Nov 2018 15:47:14 +0000 (10:47 -0500)]
freedreno: shader_t -> gl_shader_stage

Just massive search/replace for the most part.

Step towards removing ir3 dependency on disasm.h which is shared by
a2xx.  One step closer to being able to move ir3 out of gallium.

Signed-off-by: Rob Clark <robdclark@gmail.com>
6 years agofreedreno/ir3: standalone compiler updates
Rob Clark [Fri, 9 Nov 2018 14:17:03 +0000 (09:17 -0500)]
freedreno/ir3: standalone compiler updates

Signed-off-by: Rob Clark <robdclark@gmail.com>
6 years agofreedreno: move drm to common location
Rob Clark [Sun, 11 Nov 2018 15:10:46 +0000 (10:10 -0500)]
freedreno: move drm to common location

So that we can re-use at least parts of it for vulkan driver, and so
that we can move ir3 to a common location (which uses fd_bo to allocate
storage for shaders)

Signed-off-by: Rob Clark <robdclark@gmail.com>
6 years agofreedreno/drm: remove dependency on gallium driver
Rob Clark [Sun, 11 Nov 2018 15:16:30 +0000 (10:16 -0500)]
freedreno/drm: remove dependency on gallium driver

Prep work to move drm to a common location.

Slightly hacky, but the softpin debug flag is only temporary.

Signed-off-by: Rob Clark <robdclark@gmail.com>
6 years agoutil: promote u_memory to src/util
Dylan Baker [Fri, 9 Nov 2018 18:40:15 +0000 (10:40 -0800)]
util: promote u_memory to src/util

as well as os_memory*
Reviewed-by: Rob Clark <robdclark@gmail.com>
6 years agogallium: Fix uninitialized variable warning in compute test.
Eric Anholt [Mon, 26 Nov 2018 21:11:31 +0000 (13:11 -0800)]
gallium: Fix uninitialized variable warning in compute test.

The compiler doesn't know that ny != 0, so x might be uninitialized for
the printf at the end.

Reviewed-by: Elie Tournier <elie.tournier@collabora.com>
6 years agoradv: Clamp gfx9 image view extents to the allocated image extents.
Bas Nieuwenhuizen [Sat, 24 Nov 2018 22:21:05 +0000 (23:21 +0100)]
radv: Clamp gfx9 image view extents to the allocated image extents.

Mirrors AMDVLK. Looks like if we go over the alignment of height
we actually start to change the addressing. Seems like the extra
miplevels actually work with this.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=108245
Fixes: f6cc15dccd5 "radv/gfx9: fix block compression texture views. (v2)"
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
6 years agointel/compiler: fix indentation style in opt_algebraic()
Iago Toral Quiroga [Tue, 27 Nov 2018 08:43:12 +0000 (09:43 +0100)]
intel/compiler: fix indentation style in opt_algebraic()

6 years agoanv/icl: Set use full ways in L3CNTLREG
Anuj Phogat [Fri, 12 Oct 2018 21:13:21 +0000 (14:13 -0700)]
anv/icl: Set use full ways in L3CNTLREG

L3 allocation table in h/w specification recommends using 4 KB
granularity for programming allocation fields in L3CNTLREG.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
6 years agointel/icl: Set way_size_per_bank to 4
Anuj Phogat [Wed, 17 Oct 2018 22:16:37 +0000 (15:16 -0700)]
intel/icl: Set way_size_per_bank to 4

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
6 years agoi965/icl: Set use full ways in L3CNTLREG
Anuj Phogat [Thu, 11 Oct 2018 17:52:16 +0000 (10:52 -0700)]
i965/icl: Set use full ways in L3CNTLREG

L3 allocation table in h/w specification recommends using 4 KB
granularity for programming allocation fields in L3CNTLREG.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
6 years agoi965/icl: Fix L3 configurations
Anuj Phogat [Tue, 2 Oct 2018 11:28:10 +0000 (04:28 -0700)]
i965/icl: Fix L3 configurations

Use L3 configuration specified in h/w specification.

V2: Drop configs which do under allocation of l3 cache.
    Bump up the comment above table.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
6 years agobuild: stop defining unused VERSION
Eric Engestrom [Fri, 23 Nov 2018 16:37:50 +0000 (16:37 +0000)]
build: stop defining unused VERSION

Scons and autotools don't define it, and as of last commit nothing
uses it.

`VERSION` is also a generic enough name that something somewhere will
eventually clash, and we don't want to repeat the LLVM `DEBUG` fiasco.

Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
6 years agovulkan/utils: s/VERSION/PACKAGE_VERSION/
Eric Engestrom [Fri, 23 Nov 2018 15:13:02 +0000 (15:13 +0000)]
vulkan/utils: s/VERSION/PACKAGE_VERSION/

Everything else uses PACKAGE_VERSION, so let's be consistent, and
VERSION and PACKAGE_VERSION are currently defined to be the same in
meson and android, while VERSION is undefined in autotools and scons.

Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
6 years agoanv: correctly use vulkan 1.0 by default
Eric Engestrom [Fri, 23 Nov 2018 17:08:28 +0000 (17:08 +0000)]
anv: correctly use vulkan 1.0 by default

Per chapter 3.2 "Instances":
> Providing a NULL VkInstanceCreateInfo::pApplicationInfo or providing
> an apiVersion of 0 is equivalent to providing an apiVersion of
> VK_MAKE_VERSION(1,0,0).

Reported-by: Niklas Haas <git@haasn.xyz>
Fixes: 8c048af5890d43578ca4 "anv: Copy the appliation info into the instance"
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agomesa/main: fixup requirements for GL_PRIMITIVES_GENERATED
Erik Faye-Lund [Mon, 26 Nov 2018 19:36:04 +0000 (20:36 +0100)]
mesa/main: fixup requirements for GL_PRIMITIVES_GENERATED

This enum is also allowed by EXT_tessellation_shader, which is supported
on older i965 HW (as opposed to OES_geometry_shader). This was missed
when narrowing this code-path, leading to dEQP regressions.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=108868
Fixes: f09d94fbd11 "mesa/main: fix validation of transform-feedback queries"
Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Tested-by: Mark Janes <mark.a.janes@intel.com>
6 years agomesa/main: fix incorrect depth-error
Erik Faye-Lund [Thu, 22 Nov 2018 10:10:50 +0000 (11:10 +0100)]
mesa/main: fix incorrect depth-error

If glGetTexImage or glGetnTexImage is called with a level that doesn't
exist, we get an error message on this form:

Mesa: User error: GL_INVALID_VALUE in glGetTexImage(depth = 0)

This is clearly nonsensical, because these APIs don't even have a
depth-parameter. The reason is that get_texture_image_dims() return
all-zero dimensions for non-existent texture-images, and we go on to
validate these dimensions as if they were user-input, because
glGetTextureSubImage requires checking.

So let's split this logic in two, so glGetTextureSubImage can have
stricter input-validation. All arguments that are no longer validated
are generated internally by mesa, so there's no use in validating them.

Fixes: 42891dbaa12 "gettextsubimage: verify zoffset and depth are correct"
Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Juan A. Suarez <jasuarez@igalia.com>
6 years agomesa/main: check cube-completeness in common code
Erik Faye-Lund [Thu, 22 Nov 2018 16:40:47 +0000 (17:40 +0100)]
mesa/main: check cube-completeness in common code

This check is the only part of dimensions_error_check that isn't about
error-checking the offset and size arguments of
glGet[Compressed]TextureSubImage(), so it doesn't really belong in here.

This doesn't make a difference right now, apart for changing the
presedence of this error. But it will make a difference  for the next
patch, where we no longer call this method from the non-sub tex-image
getters.

Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Juan A. Suarez <jasuarez@igalia.com>
6 years agomesa/main: factor out common error-checking
Erik Faye-Lund [Thu, 22 Nov 2018 11:37:33 +0000 (12:37 +0100)]
mesa/main: factor out common error-checking

This error checking is the same for teximage and texsubimage getters, so
let's factor it out to its own function.

This will be useful when getteximage and gettexsubimage gets their own
error checking routines a bit later.

Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Juan A. Suarez <jasuarez@igalia.com>
6 years agomesa/main: factor out tex-image error-checking
Erik Faye-Lund [Thu, 22 Nov 2018 11:17:32 +0000 (12:17 +0100)]
mesa/main: factor out tex-image error-checking

This will be useful when we split error-checking for getteximage and
gettexsubimage later.

Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Juan A. Suarez <jasuarez@igalia.com>
6 years agomesa/main: remove bogus error for zero-sized images
Erik Faye-Lund [Thu, 22 Nov 2018 14:17:13 +0000 (15:17 +0100)]
mesa/main: remove bogus error for zero-sized images

The explanation quotes the spec on the following wording to justify the
error:

"An INVALID_VALUE error is generated if xoffset + width is greater than
 the texture’s width, yoffset + height is greater than the  texture’s
 height, or zoffset + depth is greater than the texture’s depth."

However, this shouldn't generate an error in the case where *all three*
of width, xoffset and the texture's width are zero. In this case, we end
up generating an unspecified error.

So let's remove this check, and instead make sure that we consider this
as an empty texture.

So let's not generate an error, there's non mandated in the spec in
xoffset/yoffset/zoffset = 0 case. We already avoid doing any work in
this case, because of the final, non-error generating check in this
function.

Fixes: b37b35a5d26 "getteximage: assume texture image is empty for non defined levels"
Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Juan A. Suarez <jasuarez@igalia.com>
6 years agomesa/main: remove ARB suffix from glGetnTexImage
Erik Faye-Lund [Wed, 21 Nov 2018 19:09:46 +0000 (20:09 +0100)]
mesa/main: remove ARB suffix from glGetnTexImage

This function has been core since OpenGL 4.3, so naming the
implementation and reporting erros using an ARB-suffix can be
confusing.

Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Juan A. Suarez <jasuarez@igalia.com>
6 years agoglsl: free or reuse memory allocated for TF varying
Gert Wollny [Fri, 16 Nov 2018 18:12:46 +0000 (19:12 +0100)]
glsl: free or reuse memory allocated for TF varying

When a shader program is de-serialized the gl_shader_program passed in
may actually still hold memory allocations for the transform feedback
varyings. If that is the case, free the varying names and reallocate
the new storage for the names array.

This fixes a memory leak:
Direct leak of 48 byte(s) in 6 object(s) allocated from:
 in malloc (/usr/lib64/gcc/x86_64-pc-linux-gnu/7.3.0/libasan.so+0xdb880)
 in transform_feedback_varyings ../../samba/mesa/src/mesa/main/transformfeedback.c:875
 in _mesa_TransformFeedbackVaryings ../../samba/mesa/src/mesa/main/transformfeedback.c:985
 ...
Indirect leak of 42 byte(s) in 6 object(s) allocated from:
  in __interceptor_strdup (/usr/lib64/gcc/x86_64-pc-linux-gnu/7.3.0/libasan.so+0x761c8)
  in transform_feedback_varyings ../../samba/mesa/src/mesa/main/transformfeedback.c:887
  in _mesa_TransformFeedbackVaryings ../../samba/mesa/src/mesa/main/transformfeedback.c:985

Fixes: ab2643e4b06f63c93a57624003679903442634a8
   glsl: serialize data from glTransformFeedbackVaryings

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
6 years agoradv: Fix opaque metadata descriptor last layer.
Bas Nieuwenhuizen [Sat, 24 Nov 2018 19:52:20 +0000 (20:52 +0100)]
radv: Fix opaque metadata descriptor last layer.

We used the layer count which results in an off by one error.

Not sure this really affects anything.

Fixes: f4e499ec791 "radv: add initial non-conformant radv vulkan driver"
Reviewed-by: Dave Airlie <airlied@redhat.com>
6 years agomesa/st: Make st_pipe_vertex_format static.
Mathias Fröhlich [Thu, 1 Nov 2018 18:03:26 +0000 (19:03 +0100)]
mesa/st: Make st_pipe_vertex_format static.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Mathias Fröhlich <Mathias.Froehlich@web.de>
6 years agomesa/st: Use binding information from the VAO in feedback rendering.
Mathias Fröhlich [Thu, 1 Nov 2018 18:03:26 +0000 (19:03 +0100)]
mesa/st: Use binding information from the VAO in feedback rendering.

Use VAO binding information in feedback rendering. In theory
it should reduce the amount of buffer objects scheduled for rendering.
Feedback rendering is implemented in a crude way anyhow, so I do not
expect much gain here. But for the sake of code reuse we should
use the same code for the same task. And finally if feeback rendering
may get improved the array setup is already well done there.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Mathias Fröhlich <Mathias.Froehlich@web.de>
6 years agomesa/st: Avoid extra references in the feedback draw function scope.
Mathias Fröhlich [Thu, 1 Nov 2018 18:03:26 +0000 (19:03 +0100)]
mesa/st: Avoid extra references in the feedback draw function scope.

The change removes the reference that is held on the entries of the
vbuffers[] array. The new code does not do that anymore as following
the code into draw_set_vertex_buffers() the draw context holds an
other reference as long as it is reset down the function again.
So it should be already by that argument save to remove that
additional reference count.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Mathias Fröhlich <Mathias.Froehlich@web.de>
6 years agomesa/st: Factor out array and buffer setup from st_atom_array.c.
Mathias Fröhlich [Thu, 1 Nov 2018 18:03:26 +0000 (19:03 +0100)]
mesa/st: Factor out array and buffer setup from st_atom_array.c.

Factor out vertex array setup routines from the array state atom.
The factored functions will be used in feedback rendering in the
next change.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Mathias Fröhlich <Mathias.Froehlich@web.de>
6 years agomesa/st: Only unmap the uploader that was actually used.
Mathias Fröhlich [Thu, 1 Nov 2018 18:03:26 +0000 (19:03 +0100)]
mesa/st: Only unmap the uploader that was actually used.

In st_atom_array, we only need to unmap the upload buffer that
was actually used.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Mathias Fröhlich <Mathias.Froehlich@web.de>
6 years agomesa/st: Only care about the uploader if it was used.
Mathias Fröhlich [Thu, 1 Nov 2018 18:03:26 +0000 (19:03 +0100)]
mesa/st: Only care about the uploader if it was used.

In st_atom_array, we only need to care for unmapping the upload buffer
if we actually used it.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Mathias Fröhlich <Mathias.Froehlich@web.de>
6 years agonv50/ir: remove dnz flag when converting MAD to ADD due to optimizations
Ilia Mirkin [Sun, 25 Nov 2018 02:56:00 +0000 (21:56 -0500)]
nv50/ir: remove dnz flag when converting MAD to ADD due to optimizations

dnz flag only applies for multiplications (e.g. to make 0 * Infinity
becomes 0 instead of NaN). Once we optimize a MAD into an ADD, the dnz
flag no longer makes sense, and upsets the GM107 emitter (since it looks
at the ftz and dnz flags together).

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
6 years agowinsys/amdgpu: fix a device handle leak in amdgpu_winsys_create
Marek Olšák [Mon, 19 Nov 2018 23:17:40 +0000 (18:17 -0500)]
winsys/amdgpu: fix a device handle leak in amdgpu_winsys_create

Cc: 18.2 18.3 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agowinsys/amdgpu: fix a buffer leak in amdgpu_bo_from_handle
Marek Olšák [Mon, 19 Nov 2018 23:12:12 +0000 (18:12 -0500)]
winsys/amdgpu: fix a buffer leak in amdgpu_bo_from_handle

Cc: 18.2 18.3 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agoradv: ignore subpass self-dependencies for CreateRenderPass() too
Samuel Pitoiset [Fri, 23 Nov 2018 08:47:22 +0000 (09:47 +0100)]
radv: ignore subpass self-dependencies for CreateRenderPass() too

We really need to refactor this...

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agoradv: remove useless sync before CmdClear{Color,DepthStencil}Image()
Samuel Pitoiset [Fri, 23 Nov 2018 08:47:21 +0000 (09:47 +0100)]
radv: remove useless sync before CmdClear{Color,DepthStencil}Image()

We don't need to flush anything before these two commands as well.
This is because they have to be externally synchronized, so the
app should have called CmdPipelineBarrier() prior to that and the
driver should have flushed the caches.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agomesa/main: remove overly strict query-validation
Erik Faye-Lund [Wed, 7 Nov 2018 12:41:17 +0000 (13:41 +0100)]
mesa/main: remove overly strict query-validation

The rules encoded in this code also applies to OpenGL ES 3.0 and up,
but the per-enum validation has already been taught about these rules.
So let's get rid of this duplicate, narrow version of the validation.

Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
6 years agomesa/main: fix validation of GL_TIMESTAMP
Erik Faye-Lund [Wed, 7 Nov 2018 12:45:01 +0000 (13:45 +0100)]
mesa/main: fix validation of GL_TIMESTAMP

ctx->Extensions.ARB_timer_query is set based on the driver-
capabilities, not based on the context type. We need to check
against _mesa_has_ARB_timer_query(ctx) instead to figure out
if the extension is really supported. We also need to check for
EXT_disjoint_timer_query for GLES-support.

This shouln't have any functional effect, as this entry-point is only
valid on desktop GL, or on GLES with EXT_disjoint_timer_query in the
first place. But if this gets added to the core of a future version
of ES, this should be a step in the right direction.

Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
6 years agomesa/main: fix validation of ARB_query_buffer_object
Erik Faye-Lund [Wed, 7 Nov 2018 12:45:17 +0000 (13:45 +0100)]
mesa/main: fix validation of ARB_query_buffer_object

ctx->Extensions.ARB_query_buffer_object is set based on the driver-
capabilities, not based on the context type. We need to check against
_mesa_has_ARB_query_buffer_object(ctx) instead to figure out if the
extension is really supported.

This turns attempts to read queries into buffer objects on ES 3 into
errors, as required by the spec.

Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
6 years agomesa/main: fix validation of transform-feedback overflow queries
Erik Faye-Lund [Wed, 7 Nov 2018 15:00:59 +0000 (16:00 +0100)]
mesa/main: fix validation of transform-feedback overflow queries

ctx->Extensions.ARB_transform_feedback_overflow_query is set based on
the driver-capabilities, not based on the context type. We need to
check against _mesa_has_RB_transform_feedback_overflow_query(ctx)
instead to figure out if the extension is really supported.

This turns usage of GL_TRANSFORM_FEEDBACK_STREAM_OVERFLOW and
GL_TRANSFORM_FEEDBACK_OVERFLOW into errors on ES 3, as required by the
spec.

Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
6 years agomesa/main: fix validation of transform-feedback queries
Erik Faye-Lund [Wed, 7 Nov 2018 15:00:59 +0000 (16:00 +0100)]
mesa/main: fix validation of transform-feedback queries

ctx->Extensions.EXT_transform_feedback is set based on the driver-
capabilities, not based on the context type. We need to check against
_mesa_has_EXT_transform_feedback(ctx) instead to figure out if the
extension is really supported. We also need to check for
OES_geometry_shader.

This turns usage of GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN into an
error on ES 2, as well as usage of GL_PRIMITIVES_GENERATED on ES 3, both
as required by the spec.

Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
6 years agomesa/main: fix validation of GL_TIME_ELAPSED
Erik Faye-Lund [Wed, 7 Nov 2018 12:37:11 +0000 (13:37 +0100)]
mesa/main: fix validation of GL_TIME_ELAPSED

ctx->Extensions.EXT_timer_query is set based on the driver-
capabilities, not based on the context type. We need to check against
_mesa_has_EXT_timer_query(ctx) instead to figure out if the extension
is really supported. We also need to check for
EXT_disjoint_timer_query, which enables the same functionality for ES.

This turns usage of GL_TIME_ELAPSED into an error on ES 3, as is
required by the spec.

Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
6 years agomesa/main: fix validation of GL_ANY_SAMPLES_PASSED_CONSERVATIVE
Erik Faye-Lund [Wed, 7 Nov 2018 12:22:41 +0000 (13:22 +0100)]
mesa/main: fix validation of GL_ANY_SAMPLES_PASSED_CONSERVATIVE

ctx->Extensions.ARB_ES3_compatibility is set based on the driver-
capabilities, not based on the context type. We need to check against
_mesa_has_ARB_ES3_compatibility(ctx) instead to figure out if the
extension is really supported.

In addition, EXT_occlusion_query_boolean should also allow this
behavior.

This shouldn't cause any functional change, as all drivers that support
ES3_compatibility should in practice enable either ES3_compatibility or
EXT_occlusion_query_boolean under all APIs that export this symbol.

Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
6 years agomesa/main: fix validation of GL_ANY_SAMPLES_PASSED
Erik Faye-Lund [Wed, 7 Nov 2018 12:22:41 +0000 (13:22 +0100)]
mesa/main: fix validation of GL_ANY_SAMPLES_PASSED

ctx->Extensions.ARB_occlusion_query2 is set based on the driver-
capabilities, not based on the context type. We need to check against
_mesa_has_ARB_occlusion_query2(ctx) instead to figure out if the
extension is really supported.

In addition, EXT_occlusion_query_boolean should also allow this
behavior.

This shouldn't cause any functional change, as all drivers that support
ARB_occlusion_query2 should in practice enable either
ARB_occlusion_query2 or EXT_occlusion_query_boolean under all APIs that
export this symbol.

Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
6 years agomesa/main: fix validation of GL_SAMPLES_PASSED
Erik Faye-Lund [Wed, 7 Nov 2018 12:22:41 +0000 (13:22 +0100)]
mesa/main: fix validation of GL_SAMPLES_PASSED

ctx->Extensions.ARB_occlusion_query is set based on the driver-
capabilities, not based on the context type. We need to check against
_mesa_has_ARB_occlusion_query(ctx) instead to figure out if the
extension is really supported. We also need to check for
ARB_occlusion_query2, as ARB_occlusion_query isn't available in core
contexts.

This turns usage of GL_SAMPLES_PASSED into an error on ES 3, as is
required by the spec.

Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
6 years agomesa/main: simplify pipeline-statistics query validation
Erik Faye-Lund [Wed, 7 Nov 2018 12:40:30 +0000 (13:40 +0100)]
mesa/main: simplify pipeline-statistics query validation

The _mesa_has_ARB_pipeline_statistics_query(ctx)-helper will already
check the GLES-version according to the extension-table, so if this
extension would ever be back-ported to ES, we only need to update the
table to support this.

This shouln't have any functional effect.

Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
6 years agomesa/main: use non-prefixed enums for consistency
Erik Faye-Lund [Wed, 7 Nov 2018 14:52:23 +0000 (15:52 +0100)]
mesa/main: use non-prefixed enums for consistency

These enums all have the same values as their non-prefixed versions, and
there's several aliases for some of them. So let's switch to the
non-prefixed versions for simplicity.

Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
6 years agomesa/main: correct year for EXT_occlusion_query_boolean
Erik Faye-Lund [Wed, 7 Nov 2018 14:18:50 +0000 (15:18 +0100)]
mesa/main: correct year for EXT_occlusion_query_boolean

According to the extension spec, this was initially released in 2011,
so let's set this to the correct value.

The value of 2001 could be a copy-paste mistake, as ARB_occlusion_query
which this is based on was released then.

Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
6 years agomesa/main: correct requirement for EXT_occlusion_query_boolean
Erik Faye-Lund [Wed, 7 Nov 2018 14:13:50 +0000 (15:13 +0100)]
mesa/main: correct requirement for EXT_occlusion_query_boolean

EXT_occlusion_query_boolean require support for GL_ANY_SAMPLES_PASSED,
which ARB_occlusion_query doesn't supply. We need ARB_occlusion_query2
for this instead.

This is still not 100% accurate, as we also require support for the
GL_SAMPLES_PASSED_CONSERVATIVE target, which isn't guaranteed by either
ARB_occlusion_query nor ARB_occlusion_query2. But it should be trivial
to implement for any driver supporting ARB_occlusion_query2, as it can
simply be implemented as GL_ANY_SAMPLES_PASSED.

Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
6 years agoanv: allow exporting an imported SYNC_FD semaphore type
Tapani Pälli [Thu, 22 Nov 2018 07:41:31 +0000 (09:41 +0200)]
anv: allow exporting an imported SYNC_FD semaphore type

Fixes issues with following SkQP tests:

   unitTest_VulkanHardwareBuffer_Vulkan_EGL_Syncs
   unitTest_VulkanHardwareBuffer_Vulkan_Vulkan_Syncs

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
6 years agoglapi: add missing visibility args
Eric Engestrom [Thu, 22 Nov 2018 13:33:28 +0000 (13:33 +0000)]
glapi: add missing visibility args

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=108829
Fixes: 3218056e0eb375eeda470 "meson: Build i965 and dri stack"
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
6 years agoanv/nir: Rework arguments to apply_pipeline_layout
Jason Ekstrand [Wed, 21 Nov 2018 23:19:37 +0000 (17:19 -0600)]
anv/nir: Rework arguments to apply_pipeline_layout

Instead of taking a whole pipeline (which could be anything!), just take
a physical device and robust_buffer_access boolean.  This makes it
easier to verify that only the things in the hash actually affect
pipeline compilation.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
6 years agoanv: Put robust buffer access in the pipeline hash
Jason Ekstrand [Wed, 21 Nov 2018 23:15:37 +0000 (17:15 -0600)]
anv: Put robust buffer access in the pipeline hash

It affects apply_pipeline_layout.  Shaders compiled with the wrong value
will work but they may not be robust as requested by the app.

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
6 years agoanv: Expose VK_EXT_scalar_block_layout
Jason Ekstrand [Tue, 9 Oct 2018 15:16:56 +0000 (10:16 -0500)]
anv: Expose VK_EXT_scalar_block_layout

Our compile already splits UBO loads into scalars and the untyped
surface read messages we use for SSBO reads and writes only require
dword alignment.

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
6 years agovulkan: Update the XML and headers to 1.1.93
Jason Ekstrand [Mon, 19 Nov 2018 15:37:38 +0000 (09:37 -0600)]
vulkan: Update the XML and headers to 1.1.93

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
6 years agoradv: remove useless sync after CmdClear{Color,DepthStencil}Image()
Samuel Pitoiset [Wed, 21 Nov 2018 10:34:42 +0000 (11:34 +0100)]
radv: remove useless sync after CmdClear{Color,DepthStencil}Image()

'post_flush' is only set to NULL for the normal clear path
(ie. only vkCmdClearColorImage() and vkCmdClearDepthStencilImage()
are affected commands).

Because these two operations have to be externally synchronized
with VK_PIPELINE_STAGE_TRANSFER_BIT and VK_ACCESS_TRANSFER_WRITE_BIT,
it's useless to set those flags internallY.

VK_PIPELINE_STAGE_TRANSFER_BIT will wait for compute to be idle,
while VK_ACCESS_TRANSFER_WRITE_BIT will invalidate both L1 vector
caches and L2. RADV_CMD_FLAG_WRITEBACK_GLOBAL_L2 will be superseded
by RADV_CMD_FLAG_INV_GLOBAL_L2.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agovulkan: Allow storage images in the WSI.
Bas Nieuwenhuizen [Tue, 20 Nov 2018 20:57:27 +0000 (21:57 +0100)]
vulkan: Allow storage images in the WSI.

Since apps also have to follow the ImageFormatProperties query,
we can disallow formats that don't allow image stores (for AMD
that would be SRGB formats).

Note that this only affects anything if the app actually decides
to use the flag.

Had someone ask for this on IRC and at least on the AMD side we
can support it.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
6 years agost/nine: Remove thread_submit warning
Axel Davy [Sat, 10 Nov 2018 15:57:31 +0000 (16:57 +0100)]
st/nine: Remove thread_submit warning

thread_submit can be useful even without DRI_PRIME,
as it can help avoid missed pageflips.

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
Tested-by: Andre Heider <a.heider@gmail.com>
6 years agost/nine: Allow 'triple buffering' with thread_submit
Axel Davy [Sat, 10 Nov 2018 10:42:39 +0000 (11:42 +0100)]
st/nine: Allow 'triple buffering' with thread_submit

The path allowing triple buffering behaviour wasn't implemented
yet for thread_submit

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
Tested-by: Andre Heider <a.heider@gmail.com>
6 years agovirgl: add assert and missing function parameter
Robert Foss [Tue, 20 Nov 2018 15:38:27 +0000 (16:38 +0100)]
virgl: add assert and missing function parameter

Verify the pipe_fd_type to be of PIPE_FD_TYPE_NATIVE_SYNC.

Fixes: d1a1c21e7621b5177feb "virgl: native fence fd support"
Suggested-by: Eric Engestrom <eric.engestrom@intel.com>
Signed-off-by: Robert Foss <robert.foss@collabora.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
6 years agor600: clean up the GS ring buffers when the context is destroyed
Gert Wollny [Fri, 16 Nov 2018 11:48:08 +0000 (12:48 +0100)]
r600: clean up the GS ring buffers when the context is destroyed

This fixes two memory leaks reported by ASAN:

Direct leak of 248 byte(s) in 1 object(s) allocated from:
   in malloc (/usr/lib64/gcc/x86_64-pc-linux-gnu/7.3.0/libasan.so+0xdb880)
   in r600_alloc_buffer_struct ../../samba/mesa/src/gallium/drivers/r600/r600_buffer_common.c:578
   in r600_buffer_create ../../samba/mesa/src/gallium/drivers/r600/r600_buffer_common.c:600
   in r600_resource_create_common ../../samba/mesa/src/gallium/drivers/r600/r600_pipe_common.c:1265
   in r600_resource_create ../../samba/mesa/src/gallium/drivers/r600/r600_pipe.c:725
   in pipe_buffer_create ../../samba/mesa/src/gallium/auxiliary/util/u_inlines.h:291
   in update_gs_block_state ../../samba/mesa/src/gallium/drivers/r600/r600_state_common.c:1482

Direct leak of 248 byte(s) in 1 object(s) allocated from:
   in malloc (/usr/lib64/gcc/x86_64-pc-linux-gnu/7.3.0/libasan.so+0xdb880)
   in r600_alloc_buffer_struct ../../samba/mesa/src/gallium/drivers/r600/r600_buffer_common.c:578
   in r600_buffer_create ../../samba/mesa/src/gallium/drivers/r600/r600_buffer_common.c:600
   in r600_resource_create_common ../../samba/mesa/src/gallium/drivers/r600/r600_pipe_common.c:1265
   in r600_resource_create ../../samba/mesa/src/gallium/drivers/r600/r600_pipe.c:722
   in pipe_buffer_create ../../samba/mesa/src/gallium/auxiliary/util/u_inlines.h:291
   in update_gs_block_state ../../samba/mesa/src/gallium/drivers/r600/r600_state_common.c:1489

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Fixes: 1371d65a7fbd695d3516861fe733685569d890d0
  r600g: initial support for geometry shaders on evergreen (v2)
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
6 years agoradv: only sync CP DMA for transfer operations or bottom pipe
Samuel Pitoiset [Tue, 20 Nov 2018 15:41:23 +0000 (16:41 +0100)]
radv: only sync CP DMA for transfer operations or bottom pipe

CP DMA can only be busy when the driver copies buffers. The
only affected Vulkan commands are vkCmdCopyBuffer() and
vkCmdUpdateBuffer() (because we fallback to a copy depending on
a threshold). Clear operations are currently not concerned
because the driver always syncs after the last DMA operation.

Per the spec, these two operations have to be externally
synchronized with VK_PIPELINE_STAGE_TRANSFER_BIT.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agoradv: ignore subpass self-dependencies
Samuel Pitoiset [Tue, 20 Nov 2018 12:48:34 +0000 (13:48 +0100)]
radv: ignore subpass self-dependencies

Unnecessary as they allow the app to call vkCmdPipelineBarrier()
inside the render pass.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agoRevert "nir/builder: Assert that intN_t immediates fit"
Iago Toral Quiroga [Tue, 20 Nov 2018 08:24:28 +0000 (09:24 +0100)]
Revert "nir/builder: Assert that intN_t immediates fit"

This reverts commit 1f29f4db1e867357a119c0c7c34fb54dc27fb682.

For this to work the compiler must ensure that it never puts
the values that arrive to this helper into unsigned variables
at any point in its processing, since that would not apply sign
extension to the value and it would break the expectations here.
Unfortunately, we use uint64_t extensively to pass and copy
things around, so some times we get to this helper with values
that are not properly sign extended to 64-bit. Here is an example
for an 8-bit value that comes from a switch case:

(gdb) p /x x
$1 = 0xffffffd6

The value seems to have been sign extended to 32-bit at some point
getting proper sign extension, but then copied into a uint64_t
which wont' apply sign extension, breaking the expectations of
the assertion.

Reviewed-by: Juan A. Suarez <jasuarez@igalia.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
6 years agonir/from_ssa: fix bit-size of temporary register
Iago Toral Quiroga [Mon, 19 Nov 2018 12:58:06 +0000 (13:58 +0100)]
nir/from_ssa: fix bit-size of temporary register

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
6 years agomesa: Remove unneeded bitfield widths from the VAO.
Mathias Fröhlich [Sat, 17 Nov 2018 06:13:11 +0000 (07:13 +0100)]
mesa: Remove unneeded bitfield widths from the VAO.

With the current VAO layout we do not need to make these
fields a bitfield. We get a tight struct layout with this change
for VAO attributes.

v2: Change unsigned char -> GLubyte.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Mathias Fröhlich <Mathias.Froehlich@web.de>
6 years agomesa: Factor out struct gl_vertex_format.
Mathias Fröhlich [Sat, 17 Nov 2018 06:13:11 +0000 (07:13 +0100)]
mesa: Factor out struct gl_vertex_format.

Factor out struct gl_vertex_format from array attributes.
The data type is supposed to describe the type of a vertex
element. At this current stage the data type is only used
with the VAO, but actually is useful in various other places.
Due to the bitfields being used, special care needs to be
taken for the glGet code paths.

v2: Change unsigned char -> GLubyte.
    Use struct assignment for struct gl_vertex_format.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Mathias Fröhlich <Mathias.Froehlich@web.de>
6 years agotnl: Use gl_array_attribute::_ElementSize.
Mathias Fröhlich [Sat, 17 Nov 2018 06:13:11 +0000 (07:13 +0100)]
tnl: Use gl_array_attribute::_ElementSize.

Instead of open coding the size computation, use the
already available gl_array_attribute::_ElementSize value.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Mathias Fröhlich <Mathias.Froehlich@web.de>
6 years agonouveau: Use gl_array_attribute::_ElementSize.
Mathias Fröhlich [Sat, 17 Nov 2018 06:13:11 +0000 (07:13 +0100)]
nouveau: Use gl_array_attribute::_ElementSize.

Instead of open coding the size computation, use the
already available gl_array_attribute::_ElementSize value.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Mathias Fröhlich <Mathias.Froehlich@web.de>
6 years agomesa: Unify glEdgeFlagPointer data type.
Mathias Fröhlich [Sat, 17 Nov 2018 06:13:11 +0000 (07:13 +0100)]
mesa: Unify glEdgeFlagPointer data type.

Use GL_UNSIGNED_BYTE as initialization data type
for the edge flag vertex attribute array. The same datatype
is used in the glEdgeFlagPointer function when setting the
array pointer.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Mathias Fröhlich <Mathias.Froehlich@web.de>